Questions tagged [nswagstudio]
57 questions
21
votes
2 answers
Using Swashbuckle 5.x specify nullable = true on a Generic T Parameter reference property
I recently upgraded my API to a .net core 3.1 server using Swashbuckle 5 with the newtonsoft json nuget, which produces an openapi 3 schema. I then use NSwag to generate a C# API. Previously I had a .net core 2.2 server with swashbuckle 4, producing…

Adam Diament
- 4,290
- 3
- 34
- 55
11
votes
3 answers
Swagger C# Enum generation - underlying int values do not match the original enum
I created an enum on my server with integer values set manually rather than the default increment up from 0
public enum UserType
{
Anonymous = 0,
Customer = 10,
Technician = 21,
Manager = 25,
Primary = 30
}
My server is running…

Adam Diament
- 4,290
- 3
- 34
- 55
6
votes
3 answers
How to have different names for my API DTO's (based on the generator) with Nswag?
I have a .NET 5.0 ASP.NET Core project and I am using Nswag to generate an API client.
Let's say I have the following API model:
public class GetFooListResponseModel
{
public string Bar { get; set; }
}
What I would like is 2 things. Let's start…

S. ten Brinke
- 2,557
- 4
- 25
- 50
5
votes
0 answers
Using OpenApiReference, how to configure code generator options using a .nswag json options file (or any alternative)
Context
I've added a connected service to my .NET 6 project and using NSwagCSharp code generator to generate the client. (In my previous project I used NSwagStudio)
I discovered that in the .csproj file there is a possibility to add…

g.pickardou
- 32,346
- 36
- 123
- 268
5
votes
1 answer
Can we configure NSwagCSharp code generator in visualstudio csproj project file?
NSwagStudio provide us with lots of settings to get a custom auto-generated swagger client in C#.
But when we use VisualStudio 2019 Solution Explorer and open the "Connected Services" on a project, we can add an OpenAPI service from a swagger json…

Francois Denis
- 53
- 7
4
votes
1 answer
NSwag and multiple api versions
Consider controllers below:
namespace Web.Controllers
{
[ApiVersioning("1.0")
[Route("api/v{version:apiVersion}/[controller]")]
public class Product : ApiController
{
[HttpGet("id")]
public IHttpActionResult…

Ali Bahrami
- 5,935
- 3
- 34
- 53
4
votes
1 answer
Change NSwagStudio serialization setting to allow for Nulls
Is there a way to change the settings in NSwagStudio so that when the JSON serialization setting outputs as Newtonsoft.Json.Required.AllowNull instead of Newtonsoft.Json.Required.Always?
I currently have the property manually changed to allow for…
3
votes
0 answers
Swagger (NSwag) client response wrapper or envelope that's undefined in the swagger document
I am uncertain what to search for to solve this issue, and/or what the name is of the domain of the problem.
I am attempting to digest an API using swagger.
Consider this response:
"responses": {
"200": {
"description": "OK",
…

Jim Hume
- 51
- 1
- 6
3
votes
2 answers
Angular Ant Desing NG Zorro Table- Not able to display data
I am currently developing an entity framework project, and I am using nSwagStudio to link to the models created in the service
So in the client side I just import the file created by nSwag.
In my Angular component.ts I have :
import { Artigo,…

Daniel Simões
- 41
- 3
3
votes
1 answer
How do I customise the generated DTO for the C# Client in NSwagStudio
I have a generic wrapper for .NET's HttpClient but I'd like to use NSwagStudio's code generator to generate code that calls my generic client rather than the standard HttpClient. I have achieved most of this however there's one part I'm not able to…

Mark
- 2,392
- 4
- 21
- 42
3
votes
0 answers
How to declare Nullable response types in SwashBuckle (generating clients in NSwagStudio)
We use SwashBuckle to configure our AspNet Core (Service fabric) project to generate Swagger json and UI.
Then we use NSwagStudio to generate typescript and C# clients out of nswag.json template with swagger generated by Swashbuckle.
Recently there…

Hari
- 384
- 1
- 6
- 20
3
votes
0 answers
NSwag Studio - How to remove the StringEnumConverter attribute from the generated enum properties?
I'm generating client C# code using NSwag Studio. All my enum properties have this attribute applied:
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
Is there a way to NOT have that attribute added to the…

Marques
- 1,894
- 2
- 16
- 19
3
votes
1 answer
NSwagStudio, include Http request method name in client method names generated with NSwag
I generate an Angular client for a.Net Core 3.1 API using NSwagStudio.
The API includes endpoints that can be used with multiple Http request types (e.g. POST, GET).
The client generates a method for each request with the same base name, plus a…

Ole EH Dufour
- 2,968
- 4
- 23
- 48
3
votes
6 answers
NSwag MSBuild "The method 'get' on path '/api/Account' is registered multiple times"
I'm trying to generate a swagger specification with NSwag.MSbuild but whenever I do it throws me this message:
The method 'get' on path '/api/Account' is registered multiple times
Now the problem is that my methods are route-less as shown below…

user2696482
- 63
- 2
- 8
3
votes
0 answers
Extension point or access to OpenApiDocument from Liquid Template
We have Specification Extensions (i.e. x-isPrimaryKey) in our generated OpenApiDocument and need to add them as ClassDecorators to our Angular models.
e.g. We communicate if is Pk, Fk and property level permissions.
I am successfully overriding the…

ttugates
- 5,818
- 3
- 44
- 54