Questions tagged [nswag]

NSwag is a Swagger 2.0 API toolchain for .NET, TypeScript and other platforms, written in C#. The Swagger specification uses JSON and JSON Schema to describe a RESTful web API. The project provides tools to generate Swagger specifications from existing Web API controllers and client code from these Swagger specifications.

The project combines the functionality of Swashbuckle (Swagger generation) and AutoRest (client generation) in one tool chain. This way a lot of incompatibilites can be avoided and features which are not well described by the Swagger specification or JSON Schema are better supported (e.g. inheritance, enum and reference handling). The NSwag project heavily uses NJsonSchema for .NET for JSON Schema handling and C#/TypeScript class/interface generation.

http://NSwag.org

414 questions
0
votes
1 answer

Media type ignored in open api response

I'm trying to include a bad request (400) response schemas in the open api document for the web api I'm building in .NET 6. The problem is, the media type always defaults to application/octet-stream even though I explicitly set it to…
mafus1
  • 191
  • 1
  • 6
0
votes
2 answers

NSWAG update to .NET6 - .NETPlatform,Version=v6.0 not found

I've updated all projects in my solution to use .net6, and have updated nswag json file to runtime to Net60. I have .net 6.0.100 installed. Here is the build output $ dotnet build Solution.sln Microsoft (R) Build Engine ersion 17.0.0+c9eb9dd64 for…
David McEleney
  • 3,397
  • 1
  • 26
  • 32
0
votes
1 answer

Get wrong date from material datepicker

I'm using angular material 13 and asp.net core 5 and use nswag to generate client type script class. also i customize dateadapter for angular material datepicker. I have problem with sending date value to api because when I select a date for example…
0
votes
2 answers

NSwag Studio C# generated client code does not have any return types assigned

I am trying to generate some client code from a swagger.json file and the methods created by NSwag do not have any return types as you can see below: Can anyone tell me what I might be doing wrong? This is my first time using NSwag to…
0
votes
0 answers

Nswag (asp.net core) --> Typescript (Angular). ModelBinder not binding multipart endpoint

I have the following net core 6.0 controller: [HttpPost("/clients/{clientId}/authority-to-release-form")] [ProducesResponseType(200, Type = typeof(long))] public async Task Post(long clientId, [FromForm][ModelBinder(BinderType =…
Rod
  • 63
  • 1
  • 4
0
votes
0 answers

Using NSwag to generate C# POCO based on OPEN-Api3 documents

I am planning on using NSwag CSharpClientGenerator to generate POCO classes for a project. I am having following two issues. In my sample console project, I am using a valid OpenApi3 spec document and it produces an empty partial class with no…
Maharaj
  • 313
  • 2
  • 3
  • 14
0
votes
1 answer

C# Polymorphic models with NSwag

Within my Asp.Net Core v5 application we have the following models public class StorageRecordTypeMetadataBase { public string PropertyName { get; set; } public bool Required { get; set; } } public class StringRecordTypeMetadata:…
Robert J.
  • 2,631
  • 8
  • 32
  • 59
0
votes
0 answers

How can Add new custom Section in Swagger?

I want to add a new section inside Swaggar, Please help me how can I do this? { "openapi": "3.0.0", "info": { }, "paths": { }, "components": { }, "NEWSection": { // Add New Section Here } }
ali
  • 33
  • 7
0
votes
0 answers

Failed to join using Open API in ASP.NET Core

Thanks for the method you provided. I need to join Open API now, I encountered this error, what is the reason? I have another project that has Swagger api on behalf of it. I now add it to the url according to the documentation, and an error is…
Modi
  • 13
  • 2
0
votes
1 answer

How to show the 'discriminator' in generated documentation by Nswag?

we have developed an api and used the tool Nswag to automatically generate the Swagger api documentation. We have some endpoints in our api, where we want to update some fields by using inheritance. For nearer explanation, we have one update method…
0
votes
0 answers

NSwagStudio how to generate enum properties as string

I'd like to generate enum properties as string but when I use the NSwagStudio or Unchase OpenApi extension for VS2019 for generating C# client code, there is no specific property to do this. In the properties file ConnectedServices.json there are…
Marco Di Scala
  • 424
  • 1
  • 7
  • 18
0
votes
1 answer

Nswag - specify order of controller names

.NET Web APi, .NET Framework 4.8, Nswag 12.3 Instead of random order of web api endpoints, or alphabetical - my customer would like them ordered in a specific order. For example, the first thing a user does is Login. So customer would like Login…
Bubba
  • 192
  • 1
  • 3
  • 14
0
votes
1 answer

With NSwag for C# how do we create multiple client classes for different API in the same client project

I have successfully created a Client class for my API using NSwag generator. But how do I create another Client class for my second API using NSwag generator I use NSwag as it generators an Interface for the Client class and other great things
GregJF
  • 456
  • 4
  • 14
0
votes
1 answer

nswag error in .NET 5.0, Process is terminating due to StackOverflowException

I am using aspnetzero framework. After upgrading .Net core to .Net5, I am facing an issue when running refresh.bat. It's throwing below mentioned error Executing file '..\EMA.Web.Host\nswag\service.config.nswag' with variables 'Process is…
0
votes
0 answers

How can I get Nswag generated api client to stop producing Object reference error?

I've got a legacy service that I need to emulate that uses Soap as the message format. Unfortunately, due to various circumstances, I'm stuck using asmx and .Net Framework (due to it's Soap handling capabilities) My problem is that I now need to…
AmFearLiathMor
  • 183
  • 1
  • 11