json-schema-to-openapi-schema
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -7,3 +7,5 @@ # Changelog | ||
## [Unreleased] | ||
## [0.4.0] - 2019-10-04 | ||
### Added | ||
- Take the first JSON Schema `example` and put in OpenAPI Schema Object `example` | ||
@@ -10,0 +12,0 @@ ## [0.3.0] - 2018-12-18 |
13
index.js
@@ -35,3 +35,4 @@ const schemaWalker = require('@cloudflare/json-schema-walker'); | ||
schema = rewriteIfThenElse(schema); | ||
schema = rewriteExclusiveMinMax(schema); | ||
schema = rewriteExclusiveMinMax(schema); | ||
schema = convertExamples(schema); | ||
@@ -152,2 +153,11 @@ if (typeof schema['patternProperties'] === 'object') { | ||
function convertExamples(schema) { | ||
if (schema['examples'] && Array.isArray(schema['examples'])) { | ||
schema['example'] = schema['examples'][0]; | ||
delete schema['examples']; | ||
} | ||
return schema; | ||
} | ||
function rewriteConst(schema) { | ||
@@ -196,2 +206,1 @@ if (schema.const) { | ||
module.exports = convert; | ||
{ | ||
"name": "json-schema-to-openapi-schema", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Converts a JSON Schema to OpenAPI Schema Object", | ||
@@ -10,4 +10,4 @@ "main": "index.js", | ||
}, | ||
"repository": "github:wework/json-schema-to-openapi-schema", | ||
"author": "Phil Sturgeon <phil.sturgeon@wework.com>", | ||
"repository": "github:openapi-js/json-schema-to-openapi-schema", | ||
"author": "Phil Sturgeon <me@philsturgeon.uk>", | ||
"license": "MIT", | ||
@@ -14,0 +14,0 @@ "devDependencies": { |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
47192
33
1693