enhance(backend): enhance SchemaType handling of anyOf (#9762)

* enhance(backend): enhance anyOf handling

* clean up
This commit is contained in:
tamaina
2023-02-01 20:04:01 +09:00
committed by GitHub
parent 387fcd5c5d
commit 7c3143b8e5
3 changed files with 71 additions and 48 deletions

View File

@@ -29,14 +29,22 @@ export const meta = {
export const paramDef = {
type: 'object',
properties: {
username: { type: 'string', nullable: true },
host: { type: 'string', nullable: true },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
detail: { type: 'boolean', default: true },
},
anyOf: [
{ required: ['username'] },
{ required: ['host'] },
{
properties: {
username: { type: 'string', nullable: true },
},
required: ['username']
},
{
properties: {
host: { type: 'string', nullable: true },
},
required: ['host']
},
],
} as const;