First, thanks a lot for this excellent library, I think it perfectly mixes the amount of stuff that happens automagically with the customization enabled by the filters!
I am serving multiple Swagger documents and they don't all need the same security definitions. It seems that we can only define those definitions once and for all documents (in SwaggerGenOptions.AddSecurityDefinition), so I tried to write a DocumentFilter that scans all the pathes and their corresponding security requirements, and cleans up the unnecessary security definitions. It kinda works, except that I realized that the clean-up I was performing reflected in all documents, and that this IDictionary<string, SecurityScheme> was effectively shared by all documents.
Would there be an other way to achieve what I'm looking for?
+1
It's weird that most of the swagger definitions are shared. It would have been much more interesting to put everything inside the SwaggerDoc() function. Of cource, you can reuse the same object between multiple swagger definitions and you'd have the full control on this.
@domaindrivendev Please take a look.
@Odonno Yes it would be nice to have per-document configuration but unfortuntely the code has evolved in a different direction and this would require a significant refactor at this point, and there's many other items that are higher prioritiy.
With that said, I think the underlying goal for this issue will be possible in v6.0.0 thanks to the following #1922
Most helpful comment
+1
It's weird that most of the swagger definitions are shared. It would have been much more interesting to put everything inside the
SwaggerDoc()function. Of cource, you can reuse the same object between multiple swagger definitions and you'd have the full control on this.