Fixing some errors in the generated spec.

This commit is contained in:
Michael Drury 2022-02-24 23:25:03 +00:00
parent 01bb56cbf4
commit 4b3da534e3
3 changed files with 8 additions and 11 deletions

View File

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

View File

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

View File

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