Last post Jan 08, 2019 08:12 PM by mgebhard
Jan 08, 2019 05:53 PM|coding786|LINK
I need to create a base webapi such that any client webapi which inherits from base web api gets swagger as a service offered (similar like addmvc method) .
This way client api do not need to write swagger integration code for its own. Client api can provide swagger paramters (version, title etc) from its config to swagger extension method.
Any suggestions/samples ?
Jan 08, 2019 06:07 PM|mgebhard|LINK
Unclear, post source that reproduces this issue. Are you simply trying to encapsulate Swagger configuration into one line?
Jan 08, 2019 06:20 PM|coding786|LINK
Jan 08, 2019 07:12 PM|mgebhard|LINK
i dont need to write code to configure mvc.
not totally true and only if the default configuration is used. Still you must opt-in to Core 2.1 and 2.2...
Similarly consumer of my base api will not need to write swagger configuration code. It can add swagger simply by writing a single line like addswagger and swagger will be configured fr him
I believe the concepts you are looking for are covered in the ASP.NET
Core App Start up fundamentals and
Add configuration at startup from an external assembly. Otherwise, you can write a static class or extension method simplify a default startup configuration.
Jan 08, 2019 07:53 PM|coding786|LINK
Jan 08, 2019 08:12 PM|mgebhard|LINK
Thnks, i ll take a deep dive at it. I hope swagger can be configured with the way you suggested.
Also can you elaborate a little more on your comment regarding using static class n extension method ? Amy sample for the same ?
It a pretty common subject... cleaning up the startup. I believe it's in the previously linked doc or maybe I'm thinking of the community spot light.