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

Handle multiple document versions in SwaggerUI and Redoc #2016

Merged
merged 1 commit into from
Feb 15, 2021
Merged

Handle multiple document versions in SwaggerUI and Redoc #2016

merged 1 commit into from
Feb 15, 2021

Conversation

SukharevAndrey
Copy link

Last changes to Swashbuckle returned back old options' mutation bug that prevents generating SwaggerUI and Redoc pages for separate swagger document versions.
Authors suggest to use a different overload of UseSwaggerUI and UseRedoc here: #1996
But I still think that singleton options mutation is misleading and users don't expect that. So in this PR I restored the old behaviour and also added new tests to ensure it will not break again.

@domaindrivendev
Copy link
Owner

This whole area has been a frustrating game of whackamole - hence the back and forth. Looking at some of the existing ASP.NET middleware, I've noticed most of them provide an overload for passing an explicit option instance and if this isn't provided, then the injected options instance is used. But none of them seem to support a hybrid approach - i.e. where you can use the injected options but also enrich them in the context of a given middleware.

So, the current API is a little odd in general, and ideally I'd like to simply remove the "hybrid" overlaod. But in lieue of that, yours is a very nice solution to support it without having the unexpected mutation behavior.

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

Successfully merging this pull request may close these issues.

None yet

2 participants