question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to pass code generation options in VS "Add new OpenAPI service reference" dialog

See original GitHub issue

I couldn’t find any example of specifying code generation options in this modal:

image

Since this is using NSwag underneath, I was wondering if you know how MS implemented passing options. For example I tried a few without success:

GenerateClientInterfaces=true
/GenerateClientInterfaces=true
GenerateClientInterfaces:true
/GenerateClientInterfaces:true

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dougbucommented, Nov 4, 2019

The options supported in that field are passed directly on the dotnet dotnet-nswag.dll openapi2csclient or dotnet dotnet-nswag.dll swagger2tsclient command line. Anything those commands support should be fine.

I’m not sure whether the field remains in VS but editing the .csproj will always work e.g.

<OpenApiReference Include="../nswagApiExplorerString.json" Options="/GenerateDtoTypes:false" />

or

<OpenApiReference Include="../nswagApiExplorerString.json">
    <Options>/GenerateDtoTypes:false</Options>
</OpenApiReference>
0reactions
RicoSutercommented, Nov 4, 2019

Its this one but we need to rename it i think https://github.com/RicoSuter/NSwag/wiki/ServiceProjectReference

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generating HTTP API clients using Visual Studio ...
The first step in generating an OpenAPI client is to right-click your project in Visual Studio and selecting “Add Connected Service.” Adding a ......
Read more >
How to call a REST service in .NET if you have its Open ...
When the new project is ready, click “Add -> Service Reference” in the project's context menu and select “OpenAPI”. Then fill out the...
Read more >
Using OpenApiReference To Generate Open API Client ...
I this post I show how you can customise the code generated by the OpenApiReference tooling from Visual Studio's Connected Services using ...
Read more >
Add new OpenAPI service reference to .NET Core 3.0 projects
At first glance it seemed fairly simple. Right click the project and select: “Add -> Service Reference”. Image displaying how to start the...
Read more >
Using OpenAPI Auto-Generated Clients in ASP.NET Core
Adding a service reference in Visual Studio is very easy. Select the project in Solution Explorer and choose Project | Add Service Reference...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found