I'd like to know how to rename generated swagger.json

when I add an OpenAPI service reference to my project in Visual studio 2019 via "Add new OpenAPI service reference" option.

I assume it should be something like it's done with a "ClassName".
<ItemGroup>
<OpenApiReference Include="OpenAPIs\swagger.json" CodeGenerator="NSwagCSharp" Namespace="PetStore.Client">
<SourceUri>https://petstore.swagger.io/v2/swagger.json</SourceUri>
<ClassName>PetStoreClient</ClassName>
<OutputPath>PetStoreClient.cs</OutputPath>
<Options>/GenerateClientInterfaces:true /ClientBaseClass:ClientBase</Options>
</OpenApiReference>
</ItemGroup>
To change this just change the Include parameter of <OpenApiReference /> to another path. Then refresh the service reference.

This might require cleaning the solution manually (for some reason OpenApi related things in bin and obj don't clean themselves sometimes).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With