Alexander Kulygin
Alexander Kulygin

Reputation: 41

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>

Upvotes: 3

Views: 1668

Answers (1)

Krzysztof Bociurko
Krzysztof Bociurko

Reputation: 4662

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).

Upvotes: 1

Related Questions