-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint error: Expected type Schema
(object) but got boolean
appears when linting API definition
#1296
Comments
seems like your indentation is incorrect. the second allOf schema should be under an array components:
schemas:
MyObject:
type: object
additionalProperties: false
allOf:
- $ref: '#/components/schemas/MyObjectBase'
- properties:
property1: true
property2: true
required:
- property2
MyObjectBase:
type: object
properties:
property1:
type: string
property2:
type: string
required:
- property1
|
Does this solve your issue? Can this be closed? |
@jeremyfiel I don't think it does. The issue is that the linter doesn't recognise a boolean value of properties. And I don't know if it's better to allow the booleans or use |
Thanks everyone for the clear explanations. It's a valid bug IMO, although kind of an edge case for a specific way to extend a closed schema, I'm actually not sure I've seen this usage before in an OpenAPI context. For organisations who do control their own schemas, I think enabling |
It depends which version of OAS they are using to determine if this is a bug or not. In JSON Schema draft 7+, it is valid to have a Boolean schema or an object schema but that requires the use of OAS 3.1.x. if using OAS 3.0.x, Boolean schemas were not allowed and must be an empty schema |
JSON Schema defines property keywords to be either boolean or object schema >Each value of this object MUST be a valid JSON Schema https://json-schema.org/draft/2020-12/json-schema-core#name-properties fixes Redocly#1296
`SchemaProperties` JSON Schema defines property keywords to be either boolean or object schema >Each value of this object MUST be a valid JSON Schema https://json-schema.org/draft/2020-12/json-schema-core#name-properties fixes Redocly#1296
`SchemaProperties` JSON Schema defines property keywords to be either boolean or object schema >Each value of this object MUST be a valid JSON Schema https://json-schema.org/draft/2020-12/json-schema-core#name-properties fixes Redocly#1296
Describe the bug
Upon linting a valid API Definition, the error message "Expected type
Schema
(object) but gotboolean
" appearsTo Reproduce
Steps to reproduce the behavior:
Given this
redocly.yaml
file:redocly.yaml.zip
And this OpenAPI file
openapi.yaml.zip
Run this command: redocly lint openapi.yaml
See error: Expected type
Schema
(object) but gotboolean
Expected behavior
In accordance with JSON Schema documentation:
https://json-schema.org/understanding-json-schema/reference/object#extending, in order to extend closed schemas you can write your schema as in the example below:
However, it seems Redocly CLI does not cover this use case since the error message occurs:
The text was updated successfully, but these errors were encountered: