openapi: Fix misuse of nullable as sibling of oneOf.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-01-23 15:47:15 -05:00
committed by Anders Kaseorg
parent 3b84dd3b8c
commit 0ba41328fd
2 changed files with 15 additions and 1 deletions

View File

@@ -53,6 +53,20 @@ async function checkFile(file) {
console.error("%s:%d:%d: Siblings of $ref have no effect", file, line, col);
ok = false;
}
const combinator = ["allOf", "anyOf", "oneOf"].find((combinator) =>
node.has(combinator),
);
if (node.has("nullable") && combinator !== undefined) {
const {line, col} = lineCounter.linePos(node.range[0]);
console.error(
`%s:%d:%d: nullable has no effect as a sibling of ${combinator}`,
file,
line,
col,
);
ok = false;
}
},
Pair(_key, node) {

View File

@@ -4191,11 +4191,11 @@ paths:
value:
description: |
The new value of the property.
nullable: true
oneOf:
- type: string
- type: boolean
- type: integer
nullable: true
example:
{
"type": "realm",