const validator = require('oas-validator')
const a = {
"x-default": 1,
anyOf: [
{ type: 'array', items: { type: 'string' } },
{
type: 'object',
additionalProperties: { enum: [ 'commonjs', 'module' ] }
}
]
}
const openAPI = {
openapi: '3.0.3',
info: {
title: 'showcase',
version: '1.0.0',
},
components: {
schemas: {
GeneralItem: a
}
},
paths: {
'/': {
get: {
responses: {
'200': {
"description" : "OK",
"content" : {
'application/json':{
"schema": {
"$ref": "#/components/schemas/GeneralItem"
}
}
}
}
}
}
}
}
}
const validate = async () => {
await validator.validateInner(openAPI, {})
.catch(err => {
console.error(err)
}
)};
await validate()
.catch(err => {
console.error(err)
})