zulip/zerver/openapi/testing.yaml
orientor fbf647283b openapi: Fix validate_against_openapi_schema nested object validation.
We had a bug in `validate_against_openapi_schema` that prevented it
from correctly inspecting nested arrays.

Fix the bug and address all the exceptions, either via
EXCLUDE_PROPERTIES or fixing them when simple.  Also add a test case
for nested verification.
2020-06-20 13:23:39 -07:00

137 lines
3.9 KiB
YAML

test1:
responses:
'200':
content:
application/json:
schema:
properties:
top_array:
type: array
items:
oneOf:
- type: object
properties:
obj:
oneOf:
- type: array
items:
type: string
- type: object
properties:
str3:
type: string
- type: array
items:
type: object
properties:
str1:
type: string
str2:
type: string
example:
{
"top_array": [
{
"obj": {
"str3": "test"
}
},
[
{
"str1": "success",
"str2": "success"
}
]
]
}
test2:
responses:
'200':
content:
application/json:
schema:
properties:
top_array:
type: array
items:
oneOf:
- type: object
properties:
obj:
oneOf:
- type: array
items:
type: string
- type: object
properties:
str3:
type: string
- type: array
items:
type: object
properties:
str1:
type: string
str2:
type: string
example:
{
"top_array": [
{
"obj": {
"str3": "test",
"str4": "extraneous"
}
},
[
{
"str1": "success",
"str2": "success"
}
]
]
}
test3:
responses:
'200':
content:
application/json:
schema:
properties:
top_array:
type: array
items:
oneOf:
- type: object
properties:
obj:
oneOf:
- type: array
items:
type: string
- type: object
- type: array
items:
type: object
properties:
str1:
type: string
str2:
type: string
example:
{
"top_array": [
{
"obj": {
"str3": "test"
}
},
[
{
"str1": "success",
"str2": "success"
}
]
]
}