Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename OpenAPI's reference generated swagger.json

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

enter image description here

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

enter image description here

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>
like image 281
Alexander Kulygin Avatar asked Sep 11 '26 11:09

Alexander Kulygin


1 Answers

To change this just change the Include parameter of <OpenApiReference /> to another path. Then refresh the service reference.

refresh button

This might require cleaning the solution manually (for some reason OpenApi related things in bin and obj don't clean themselves sometimes).

like image 75
Krzysztof Bociurko Avatar answered Sep 13 '26 07:09

Krzysztof Bociurko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!