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

Are nested visitors really not supported for preprocessors and decorators? #331

Open
aviskase opened this issue Jul 27, 2021 · 1 comment
Labels

Comments

@aviskase
Copy link
Contributor

I've noticed that docs says

Preprocessors and decorators do not support nested visitors.

https://github.com/Redocly/openapi-cli/blob/master/docs/custom-rules.md#L19

But in our preprocessing plugin we successfully use nested visitor Parameter > Schema.

Similarly, in the #294 (comment) there is a PathItem > Operation nested visitor.

Can you confirm that docs are still right and successful usage is accidental (so we shouldn't rely on it)?

@RomanHotsiy
Copy link
Member

Can you confirm that docs are still right and successful usage is accidental (so we shouldn't rely on it)?

Preprocessors and decorators use same traversal logic as regular rules but there is caveat that you can modify something and break parent visiting logic. That's why we decided to disallow it in the docs. We're not going to break it I believe so I would be open to change the wording in the docs to warn about potential unexpected behaviour vs saying it's not supported.

I need to refresh my understanding of what can go wrong with nested decorators to be specific in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants