Open
Description
Schema Inaccuracy
The schema is trying to use anyOf
and the required
property to mark that it is expected that either one property or another is present
Example endpoint definition showing the issue:
PATCH /gists/{gist_id}
"gists/update": {
[ ... ]
requestBody: {
content: {
"application/json":
| ({
[ ... ]
files?: {
[key: string]:
| (
| ({
/** @description The new content of the file. */
content?: string;
/** @description The new filename for the file. */
filename?: string | null;
} & (
| Record<string, never>
| Record<string, never>
| Record<string, never>
))
| null
)
| undefined;
};
} & (Record<string, never> | Record<string, never>))
| null;
};
};
};
"/gists/{gist_id}": {
[ ... ]
"patch": {
[ ... ]
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"properties": {
[ ... ]
"files": {
[ ... ]
"type": "object",
"additionalProperties": {
"type": "object",
"nullable": true,
"properties": {
"content": {
"description": "The new content of the file.",
"type": "string"
},
"filename": {
"description": "The new filename for the file.",
"type": "string",
"nullable": true
}
},
"anyOf": [
{
"required": [
"content"
]
},
{
"required": [
"filename"
]
},
{
"type": "object",
"maxProperties": 0
}
]
}
}
},
"anyOf": [
{
"required": [
"description"
]
},
{
"required": [
"files"
]
}
],
"type": "object",
"nullable": true
},
[ ... ]
}
}
}
},
[ ... ]
},
Expected
For those anyOf
not to exist.
Instead, there should be 2 definitions wrapped in a oneOf
each with one of the properties that is expected at a time.
Reproduction Steps
N/A