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

Dockerfile: COPY static Swagger no such file or directory error

Docker can't find my static Swagger files. My code is working on localhost, but when I try to run on a staging server I get the following error in AWS CodePipeline: COPY failed: stat…
0
votes
1 answer

How to show the full swagger interface when using NSwag with .NET 5?

I am trying to familiarize with NSwag usage for .NET 5 as documented here. After reading, I got the impression that this documentation is outdated as it mentions methods such as UseMvc and AddMvc which are typical for .NET Core 2.1 but not for .NET…
Daan
  • 2,478
  • 3
  • 36
  • 76
0
votes
1 answer

Cannot setup Nswag in my vb.net webapi project

I have to set a WebApi project (in .NET Framework 4.6.1) written in VB.NET and i want to setup Nswag and Swagger for further implementation. I look for that guide: enter link description here and all of my C# webapi projects works well I'm trying…
DrViente
  • 37
  • 1
  • 7
0
votes
2 answers

How to stop default api vesion showing up in swagger document with NSwag in .Net Core?

After getting Api versioning fixed with following in .net core services.AddApiVersioning(options => { options.AssumeDefaultVersionWhenUnspecified = true; options.DefaultApiVersion = new…
Anayag
  • 145
  • 1
  • 10
0
votes
1 answer

How best to inject async client/request configuration into NSwag client code

We are using NSwag generated client code for a web API. The API requires an Authorization header to be set on all requests. This header value needs to be generated from async library methods (ITokenAcquisition.GetAccessTokenForUserAsync() in case it…
Dan
  • 7,446
  • 6
  • 32
  • 46
0
votes
1 answer

NSwag Not Recognizing Custom Authorization Attributes

Currently having a problem with NSwag generation on a custom authorize attribute. I have been completely unable to find anything on this issue elsewhere. I've created a custom attribute for my WebAPI and more or less followed the patterns…
0
votes
1 answer

MSBuild skips some tasks when DeployOnBuild and PublishProfile parameters are present

When I build a web project from command-line using msbuild and no special parameters, it seems to build just fine, including calling an nswag task to build TS files. When I build the same web project with the /p:DeployOnBuild=true parameter and the…
Kevin McDowell
  • 532
  • 6
  • 20
0
votes
1 answer

NSwagStudio reflection behavior with parameters

I create a simple .net5 web api. Then I get the great Rico Suter's Nswag.aspnetcore and tweak it for get my application to create the swagger.json file In the scaffolded controller I write another PUT action that TAKES AN OBJECT parameter (the…
Vic
  • 337
  • 3
  • 9
0
votes
1 answer

How to expose yaml endpoint in NSwag?

I need to expose the schema definition of API (.net core 2.2) in Yaml not JSON. I'm using NSwag. I found package NSwag.Core.Yaml https://www.nuget.org/packages/NSwag.Core.Yaml/ But I have no idea how I should use it. In Shwasbuckle things are pretty…
PaulStanek
  • 451
  • 2
  • 5
  • 7
0
votes
1 answer

UWP with nswag INotify problem with inherited properties

I have a DotNetCore Web Api and its client is a UWP APP where client is connected with api through generated Nswag file. I have a class DropDownBase in my api side which is used as a base class for many different kind of dropdown classes, and it was…
Muhammad Touseef
  • 4,357
  • 4
  • 31
  • 75
0
votes
1 answer

Swagger (via NSwag) descriptions of fields of return types

Is it possible to make Swagger UI show the xml documentation for return models? For example, let's say that the response model returns an object with a field called Data. Is it possible to make Swashbackle to expose the XML Summary for this…
tymtam
  • 31,798
  • 8
  • 86
  • 126
0
votes
1 answer

How to add bearer token to autogenerated OpenApiToCSharpClient?

I have client generated using OpenApiToCSharpClient but each request is 401 unauthorized. I have added bearer token in HttpClient like this: ClientEngine.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",…
nighthawk
  • 773
  • 7
  • 30
0
votes
1 answer

How can I add information to an endpoint in NSwag for .NET Framework?

Pretty much the same as this question, but for .NET Framework/Webforms instead of .NET Core: How can I add a little information to a controller endpoint, so that it is displayed in the swagger UI in .NET Framework? Just adding doc comments does not…
Raphael Schmitz
  • 551
  • 5
  • 19
0
votes
3 answers

NSwag - create one client per API controller

I have a Web project with different API controllers. When creating the client using NSwag, all methods from all controllers are put in the same API Client. How could I get one ApiClient per API controller? Thanks in advance.
tht
  • 1
  • 1
0
votes
2 answers

Nested Array of objects - item.toJSON is not a function

When using NSwag with my angular project, throws an error, when trying to send the data, if the object has an nested array of object as here: export interface IJobAdDto { mainJobAd: JobAddDetailsDto; differentLanguageJobAds:…