Open MattFenner opened 5 years ago
noticed the same behavior, the only mime types which worked for me were "application/json", "text/json" and "text/plain".
Edit: Oh and what other generator classes do you mean? I'm using NSwag in a ASP.net Core project (AspNetCoreToSwaggerGenerator?) and I have the same problem.
WebApiToSwaggerGenerator and AspNetCoreToSwaggerGenerator are different generators - i suspect that WebApiToSwaggerGenerator might not correctly support this - because it's deprecated I don't have the time to look into this...
Do we also have the problem with the AspNetCoreToSwaggerGenerator?
Well how do I specify the generator? I thought since I'm on a AspNetCore Project nswag defaults to the AspNetCoreToSwaggerGenerator.
@darman96 how did you integrate NSwag in your Startup.cs?
in ConfigureContainer() i have this:
services.AddSwaggerDocument( settings => { settings.DocumentName = "swagger"; });
and in my Configure(): `app.UseSwagger( settings => { settings.DocumentName = "swagger"; settings.Path = "/swagger/v1/swagger.json"; });
app.UseSwaggerUi3( settings => { settings.Path = "/swagger"; settings.DocumentPath = "/swagger/v1/swagger.json"; });`
Yes, this is using the AspNetCoreToSwaggerGenerator... otherwise you'd see obsolete warnings... please create another issue if its AspNetCoreToSwaggerGenerator related
Are you sure? Because when I hover over app.UseSwaggerUi3() I get this tool tip:
That's still a legacy leftover and will be removed as soon as the WebApiToSwaggerGenerator is completely removed from NSwag.AspNetCore (currently there for legacy users) in v13 - this is not a problem. It's important that you don't use the overloads where you provide an assembly...
Thanks for your quick response Rico, we will look into upgrading to a different generator.
Hi,
We are using the WebApiToSwaggerGenerator.GenerateForControllersAsync(controllerTypes) method to generate our swagger file, but it doesn't seem to respect any ProducesAttribute put on any of the rest endpoint methods.
For example we have a method defined:
I would expect the generated swagger should be something like:
but it is missing the produces section on the operation.
From what I can tell this feature is implemented in some of the other Generator classes. Would it be possible to also implement it on WebApiToSwaggerGenerator. Or are we forced to 'upgrade' to one of the other generators?
Thanks