open-api-to-schema
Advanced tools
Comparing version 1.0.10 to 1.0.11
{ | ||
"name": "open-api-to-schema", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Open API / Swagger file to JSON Schema Converter", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -6,4 +6,7 @@ # Open api schema converter | ||
## Usage | ||
`npm install --save open-api-to-schema` | ||
```javascript | ||
import openApiToSchema from 'open-api-to-schema' | ||
import Ajv from 'ajv' | ||
@@ -17,3 +20,12 @@ const config = { | ||
const jsonSchema = openApiToSchema('./test/fixtures/petstore-expanded.yaml', config) | ||
const jsonSchemas = openApiToSchema('./test/fixtures/petstore-expanded.yaml', config) | ||
const ajv = new Ajv() | ||
const validator = ajv.compile(jsonSchema.paths['/pet'].get[200]) | ||
const valid = validator(response.data) | ||
if (!valid) { | ||
console.error(validator.errors) | ||
} | ||
... | ||
@@ -20,0 +32,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18728
230