Open hayhay27 opened 2 years ago
Ref: It would look like this:
Better late than never
Finally I added property page support. You can enable it with property NSwagPropertyPageType=CSharp|TypeScript
Another one feature is compile-time generation for controllers (same as for OpenApiReference). Add property NSwagControllerPropertyPageEnabled=true in project where you want to generate controller.
@RicoSuter do we need to provide samples for this feature?
How to use this feature (supported only in VisualStudio for Windows but there is issue for Rider)
OpenApiReference
NSwag.ApiDescription.Client
package reference to your project - dotnet add package NSwag.ApiDescription.Client
<NSwagPropertyPageType>CSharp</NSwagPropertyPageType>
for csharp generator or <NSwagPropertyPageType>TypeScript</NSwagPropertyPageType>
for typescript generatorBuild Action
for OpenApi specification to OpenApi File Reference
There is limitation: we cannot use property page for both languages at the same time
NSwagController (same as OpenApiReference just for openapi2cscontroller
command)
NSwag.MSBuild
package reference to your project - dotnet add package NSwag.MSBuild
<NSwagControllerPropertyPageEnabled>true</NSwagControllerPropertyPageEnabled>
Build Action
for OpenApi specification to NSwag Controller File Reference
<NSwagControllerGenerateCodeOptions>/SomeCommonProperty:value</NSwagControllerGenerateCodeOptions>
Is this available? A bit confused by the above as it makes it sound like it should work in VS. I checked the latest version and latest preview and don't see it; not sure if I just haven't configured it properly or if I'm chasing something that's not there
@pinkfloydx33 Did you follow steps above?
I did but it didn't work. It's not a big deal though as I got what I needed. I was mainly trying to visualize all of the available options in one place--tracking them down through the docs is an incomplete maze and in some instances requires digging through source. I just ended up using the screenshot from the OP. Thanks
@RicoSuter how to push PR #3790 ? What I have to do?
@hayhay27 are you planning to complete it? it looks very comfortable!
Now we have to use NSwagStudio as a playground, and then transfer the keys manually to OpenApiReference 😔
Discussion for PR https://github.com/RicoSuter/NSwag/pull/3790
Investigating aproaches (in #3636) for cross-platfrom lightweight configuration I found useful feature in VS. Property window customizable via PropertyPageSchema. This approach already used in Grpc.Tools and Microsoft.Extensions.ApiDescription.Client
I made a small project to prove the concept here Then I realized that this feature not supported by Rider and open issue on youtrack (likes are welcome).
So at this time customizable property window supported only in Visual Studio but we can change that.