openapi-utils-param-to-schema
v0.0.9
Published
Create a schema from a openapi param
Downloads
87
Readme
openapi-utils-param-to-schema
Convert a param into a schema.
Installation
npm install --save openapi-utils-param-to-schema
Usage
var openApiUtils = require('openapi-utils-param-to-schema')
var postalCodeParam = {
"name": "postalCode",
"in": "query",
"required": true,
"type": "string",
"pattern": "^[1-9][0-9]{3} ?(?!sa|sd|ss)[A-Z]{2}$"
}
var schema1 = openApiUtils.paramToSchema(postalCodeParam)
console.log(schema1)
/*
{
"required": ["postalCode"],
"properties": {
"postalCode": {
"type": "string",
"pattern": "^[1-9][0-9]{3} ?(?!sa|sd|ss)[A-Z]{2}$"
}
}
}
*/