Open matt-duffett opened 1 month ago
linting is provided by two sources. Ajv JSON Schema validation per the schema and configurable rules.
JSON Schema does not consider the default
keyword as a validation keyword, thus it only provides informational data about the data type, it is not used for validation. In JSON Schema land, this is called an annotation
I don't think Redocly has a configurable rule for default
values. If you happen to write a new configurable rule, please consider sharing it with the Redocly CookBook
Thanks @matt-duffett and @jeremyfiel . We have type checking on examples, but I don't think we have it on defaults now. It's a good suggestion, I'll leave this issue open in case others have thoughts about this feature.
Redocly CLI does not seem to recognise when a fields default value does not conform to the type specified for that field. This also applies to the vscode extension.
Apologies if there is some config I am missing or already a plugin that adds this behaviour!
Steps to reproduce the behavior:
redocly lint openapi.yaml
Expected Behaviour
I would expect there to be a warning or error for the default value of 123 not to match the type of string.
Redocly Version(s)
1.17.1
Node.js
Version(s)20