const validator = require('oas-validator')
const a = {
anyOf: [{
type: 'string',
enum: ['commonjs', 'module']
}],
default: 'module'
}
const openAPI = {
openapi: '3.0.3',
info: {
title: 'showcase',
version: '1.0.0',
description: 'A sample API to illustrate OpenAPI concepts'
},
components: {
schemas: {
GeneralItem: a
}
},
paths: {
'/': {
get: {
description: 'Returns a list of stuff',
responses: {
'200': {
description: 'OK',
content: {
'application/json': {
"schema": {
"$ref": "#/components/schemas/GeneralItem"
}
}
}
}
}
}
}
}
}
const validate = async () => {
return await validator.validateInner(openAPI, {})
.catch(err => {
console.error(err)
})
}
validate()
.catch(err => {
console.error(err)
})