-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Question]: Ensuring the Correct Order of Operation and Schema Filters in Swashbuckle.AspNetCore #2993
Comments
Schemas are created as part of the process of enumerating the operations found in the document, which is why different types of filters run in a certain order. For your specific scenario, to get the behaviour your want you probably need to use a document filter and remove the schemas you wish to ignore from the almost-final document before it is serialized after your operation processors have run. |
Thank you, your response. In particular, what steps should I follow to get the correct order and how can I use the document filter correctly? |
|
Thank you very much for your response. It really helped me a lot. |
What are you wanting to achieve?
I want to provide the correct execution order of OperationFilter and SchemaFilter in Swashbuckle.AspNetCore when generating Swagger documents. In particular, I want my OperationFilter to first work to cache certain header names, then I want my SchemaFilter to ignore those cached header names. Despite specifying the order in my configuration, SchemaFilter runs before OperationFilter.
What code or approach do you have so far?
Here is a minimalistic code snippet demonstrating the issue:
Despite this order, IgnoreCachedHeaderNamesSchemaFilter runs before CacheHeaderNamesOperationFilter.
What is the expected outcome?
The expected outcome is that CacheHeaderNamesOperationFilter should run before IgnoreCachedHeaderNamesSchemaFilter, ensuring that the cached header names are available for the schema filter to process and ignore. This way, the Swagger documentation accurately reflects the intended API design.
Additional context
No response
The text was updated successfully, but these errors were encountered: