File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,14 @@ If you need to do the conversion in reverse, checkout [json-schema-to-openapi-sc
3535npm install --save openapi-schema-to-json-schema
3636```
3737
38- ## Usage
38+ ## Converting OpenAPI schema
3939
4040Here's a small example to get the idea:
4141
4242``` js
4343
4444var toJsonSchema = require (' openapi-schema-to-json-schema' );
45+ // OR: toJsonSchema = require('openapi-schema-to-json-schema').fromSchema;
4546
4647var schema = {
4748 type: ' string' ,
@@ -125,22 +126,28 @@ If the handler is not provided, the default handler is used. If `additionalPrope
125126
126127See ` test/pattern_properties.test.js ` for examples how this works.
127128
128- # Converting OpenAPI parameters
129+ ## Converting OpenAPI parameters
129130
130- OpenAPI parameters can be converted.
131+ OpenAPI parameters can be converted:
131132
132133``` js
133- {
134+ var toJsonSchema = require (' openapi-schema-to-json-schema' ).fromParameters ;
135+
136+ var param = {
134137 name: ' parameter name' ,
135138 in: ' query' ,
136139 schema: {
137140 type: ' string' ,
138141 format: ' date'
139142 }
140143}
144+
145+ var convertedSchema = toJsonSchema (param);
146+
147+ console .log (convertedSchema);
141148```
142149
143- would be converted to :
150+ The result is as follows :
144151
145152``` js
146153{
You can’t perform that action at this time.
0 commit comments