redocly-cli
redocly-cli copied to clipboard
type array list not validated in OAS 3.1
Describe the bug
When a schema has type null defined in YAML, it is being treated as a null value and not "null" the string that defines the types.
https://json-schema.org/understanding-json-schema/reference/null.html
https://github.com/Redocly/openapi-starter/blob/main/openapi/components/schemas/Schema.yaml#L41
I believe that Schema needs to be adjusted to the following to define the type properly:
nullableOrStringProperty:
description: Property name's description (type is string or null)
type:
- string
- "null"
However, I then suspected that nothing in the type list is being validated:
https://github.com/Redocly/openapi-starter/pull/74
This bug does not exist when type is defined as a string (for example the following would produce a problem):
type: foo
To Reproduce Steps to reproduce the behavior:
- See https://github.com/Redocly/openapi-starter/pull/74
- See error (that there is no problem)
Expected behavior
problem message:
typecan be one of the following only: "object", "array", "string", "number", "integer", "boolean", "null".
Logs
There is no problem detected (which is the problem because there is a problem).
OpenAPI definition
OAS 3.1 https://github.com/Redocly/openapi-starter/blob/main/openapi/components/schemas/Schema.yaml#L41
Redocly Version(s)
1.0.0-beta.108
Node.js Version(s)
16.10
Additional context
- This was revealed by some crashing of our mock server.