Open tkumark opened 5 years ago
Just wanted to add that I'd really like this feature too
@tkumark Were you able to get a swagger.json in any format besides OpenAPI 3.0 using the CLI? I have app.UseSwagger(s => { s.SerializeAsV2 = true; }); and I still get OpenAPI 3.0 when I'd like Swagger 2.0 to use for AutoREST.
@tkumark Were you able to get a swagger.json in any format besides OpenAPI 3.0 using the CLI? I have app.UseSwagger(s => { s.SerializeAsV2 = true; }); and I still get OpenAPI 3.0 when I'd like Swagger 2.0 to use for AutoREST.
Quick look at source suggest you may need to pass in an argument to the CLI for that: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/src/Swashbuckle.AspNetCore.Cli/Program.cs
Default if argument missing seems to be v2
@tkumark Solution for you would be to run multiple CLI requests with the different versions as arguments as @snappyfoo mentioned. Example: dotnet swagger tofile --serializeasv2 --output 'swagger.json' "bin/Debug/netcoreapp3.1/ThisIsMyProject.Api.dll" v3
Solution to my problem: I didn't see that there's an option in the CLI for Swagger 2.0 via '--serializeasv2'.
Hi @domaindrivendev
I can help with this enhancement if you are OK with it.
I got it working by moving the interface IDocumentProvider
to Swashbuckle.AspNetCore.Swagger
assembly so it is accessible by the CLI project and using IDocumentProvider::GetDocumentNames()
to retrieve the registered documents.
Would this align with your design decisions or did you have another plan for this?
My other question is, do you prefer this to be a new command (e.g. tofiles
), as it might be confusing to overload the tofile
command with this functionality?
@domaindrivendev Did you get the chance to review my suggestion above? If you agree with it, I can send a PR your way this week.
@amrElroumy Any chance you have a branch or frok of this?
I see it's a long time ago, but any chance to get this PR completed @domaindrivendev / @amrElroumy ?
I need this feature too please! @amrElroumy @domaindrivendev
I need this feature too please! @amrElroumy @domaindrivendev
Pardon me folks, I have moved away from this tech stack several years ago.
+1 for this feature
Hi I am using the following command to generate the swagger files. I have v1,v2,v3 etc. is it possible to create swagger for all possible versions?
dotnet %UserProfile%\.nuget\packages\swashbuckle.aspnetcore.cli\4.0.1\lib\netcoreapp2.0\dotnet-swagger.dll tofile --output D:\tempvsts\swagger\swagger2.json D:\tempvsts\testapimgmt\WebApiService\bin\Debug\netcoreapp2.1\win7-x64\WebApiService.dll v2