Fixing some errors in the generated spec.

This commit is contained in:
Michael Drury 2022-02-24 23:25:03 +00:00
parent 46d23cfb25
commit f84a459d24
3 changed files with 8 additions and 11 deletions

View File

@ -941,21 +941,18 @@
},
"query": {
"type": "object",
"properties": {},
"required": []
"properties": {}
},
"user": {
"type": "object",
"properties": {},
"required": []
"properties": {}
},
"userOutput": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {},
"required": []
"properties": {}
}
},
"required": [

View File

@ -690,18 +690,15 @@ components:
query:
type: object
properties: {}
required: []
user:
type: object
properties: {}
required: []
userOutput:
type: object
properties:
user:
type: object
properties: {}
required: []
required:
- user
nameSearch:

View File

@ -1,8 +1,11 @@
exports.object = (props, opts) => {
return {
const base = {
type: "object",
properties: props,
required: Object.keys(props),
...opts,
}
if (Object.keys(props).length > 0 && (!opts || !opts.required)) {
base.required = Object.keys(props)
}
return base
}