domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.2k stars 1.29k forks source link

[Feature request]: Add parameter support to CLI tool #2983

Open remcolam opened 1 month ago

remcolam commented 1 month ago

Is your feature request related to a specific problem? Or an existing feature?

I need to provide additional configuration options into the assembly when using Swashbuckle.AspNetCore.Cli, on each execution.

Describe the solution you'd like

I would like to pass in some commandline parameters into the SwaggerHostFactory. I had previously already added support for this in a local fork of Swashbuckle.AspNetCore.Cli.

Is this something that would have value and should I try to create a pull request that adds this? (Currently I've worked around it by using environment settings and reading out those, but I think adding --parameters "var1=1;var2=two" is a better solution.

Additional context

No response

martincostello commented 1 month ago

Seems reasonable to me to allow you to pass values through to code like this:

https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/33309825970d823630cabc080b00398a3900f7a9/test/WebSites/CliExampleWithFactory/SwaggerHostFactory.cs#L9

We'd need to make sure that any changes didn't break the existing "duck-typing" that looks for types/methods with the right shape(s).