Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

openapi: Fix misuse of nullable as sibling of oneOf.

Anders Kaseorg0ba41328fdbf
diff --git a/tools/check-openapi b/tools/check-openapi
index 6f2f7876ee8..9da5ca1bd58 100755
--- a/tools/check-openapi
+++ b/tools/check-openapi
@@ -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) {
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 8a192b93088..69e1592c0ec 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -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",