@@ -6,15 +6,15 @@ A little NodeJS package to convert JSON Schema to a [OpenAPI Schema Object](http
66
77## Features
88
9- * converts JSON Schema Draft 04 to OpenAPI 3.0 Schema Object
10- * switches ` type: ['foo', 'null'] ` to ` type: foo ` and ` nullable: true `
11- * supports deep structures with nested ` allOf ` s etc.
12- * switches ` patternProperties ` to ` x-patternProperties `
13- * converts ` dependencies ` to an allOf + oneOf OpenAPI-valid equivalent
9+ - converts JSON Schema Draft 04 to OpenAPI 3.0 Schema Object
10+ - switches ` type: ['foo', 'null'] ` to ` type: foo ` and ` nullable: true `
11+ - supports deep structures with nested ` allOf ` s etc.
12+ - switches ` patternProperties ` to ` x-patternProperties `
13+ - converts ` dependencies ` to an allOf + oneOf OpenAPI-valid equivalent
1414
1515## Installation
1616
17- ``` shell
17+ ``` shell
1818npm install --save @openapi-contrib/json-schema-to-openapi-schema
1919```
2020
@@ -28,16 +28,15 @@ Here's a small example to get the idea:
2828const convert = require (' @openapi-contrib/json-schema-to-openapi-schema' );
2929
3030const schema = {
31- ' $schema' : ' http://json-schema.org/draft-04/schema#' ,
32- type: [' string' , ' null' ],
33- format: ' date-time' ,
31+ $schema: ' http://json-schema.org/draft-04/schema#' ,
32+ type: [' string' , ' null' ],
33+ format: ' date-time' ,
3434};
3535
3636(async () => {
37- const convertedSchema = await convert (schema);
38- console .log (convertedSchema);
37+ const convertedSchema = await convert (schema);
38+ console .log (convertedSchema);
3939})();
40-
4140```
4241
4342The example prints out
@@ -117,8 +116,8 @@ This package is [Treeware](https://treeware.earth). If you use it in production,
117116- [ All Contributors] [ link-contributors ]
118117
119118[ mikunn ] : https://github.com/mikunn
120- [ WeWork ] : https://github.com/wework
121- [ Stoplight ] : https://stoplight.io/
122- [ Phil Sturgeon ] : https://github.com/philsturgeon
119+ [ wework ] : https://github.com/wework
120+ [ stoplight ] : https://stoplight.io/
121+ [ phil sturgeon ] : https://github.com/philsturgeon
123122[ openapi-schema-to-json-schema ] : https://github.com/openapi-contrib/openapi-schema-to-json-schema
124123[ link-contributors ] : https://github.com/openapi-contrib/json-schema-to-openapi-schema/graphs/contributors
0 commit comments