Skip to content
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

OAS 3.1 - arbitrary schema keywords are classified as lint errors #1546

Open
Drew-Kimberly opened this issue May 3, 2024 · 3 comments
Open
Labels
Type: Bug Something isn't working

Comments

@Drew-Kimberly
Copy link

Describe the bug
For OAS 3.1, arbitrary keywords within schemas produce lint errors. This contradicts the 3.1 specification.

To Reproduce
Using minimal, this example spec from OpenAPI fails linting when it should pass.

Expected behavior

The spec should pass linting.

Logs

message: 'Property `myArbitraryKeyword` is not expected here.',

OpenAPI description

3.1

Redocly Version(s)

@redocly/openapi-core@1.12.0

@Drew-Kimberly Drew-Kimberly added the Type: Bug Something isn't working label May 3, 2024
@tatomyr
Copy link
Contributor

tatomyr commented May 3, 2024

Interesting. I didn't know arbitrary keys are allowed in Schema Objects. Could you share where exactly in the specification this is mentioned?
Anyway, I'm not sure if it makes sense to allow arbitrary properties in the Schema Object when linting OAS descriptions, as it makes it harder to detect typos and other mistakes.

@Drew-Kimberly
Copy link
Author

@tatomyr Thanks for the quick response! Here's the ref from the spec.

Typos would still be detected in most cases since schema definitions would be missing required properties. Obviously my preference here is that ReDocly strictly adheres to the specification by default 🙏 (rules can always toggle certain behaviors)

@tatomyr
Copy link
Contributor

tatomyr commented May 7, 2024

Thanks for the link @Drew-Kimberly!

I'm still not sure if we want to change the behaviour. Let's wait until we get more votes for that.

Meanwhile, you can tweak the behaviour by supplying the type extension via a plugin. I understand it won't change the default settings but most users don't need those additional keys (or they can use specification extensions instead; BTW, could the specification extension cover your case?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants