These are chat archives for NJsonSchema/NJsonSchema

13th
Jun 2018
Stijn Herreman
@stijnherreman
Jun 13 11:22
@RSuter Is it possible that there are code changes required in NSwag, to handle the conventions of ApiControllerAttribute in ASP.NET Core 2.1 ?
Infer smarter defaults for action parameters: [FromBody] for complex types, [FromRoute] when possible, otherwise [FromQuery]
Stijn Herreman
@stijnherreman
Jun 13 11:28
I had a look at the code, I guess OperationParameterProcessor.cs needs to be modified to handle it
Rico Suter
@RSuter
Jun 13 11:33
@stijnherreman did you try the new AspNetCoreToSwaggerGenerator?
it's completely api explorer based and should handle this way better as the descs are coming from asp.net and not implemented in nswag
Stijn Herreman
@stijnherreman
Jun 13 11:33
probably not, I'm just using app.UseSwaggerUi3(typeof(Startup).GetTypeInfo().Assembly);
first ASP.NET Core project I'm doing
Rico Suter
@RSuter
Jun 13 11:34
the new thing is app.UseSwaggerUi3WithApiExplorer();
Stijn Herreman
@stijnherreman
Jun 13 11:34
ah great, thank you :)
Rico Suter
@RSuter
Jun 13 11:34
the idea is to eventually migrate to this
  • services.AddSwagger()
in configureservices
please report any problems
Stijn Herreman
@stijnherreman
Jun 13 11:35
ok
I ignore the [Obsolete] warning I guess
Rico Suter
@RSuter
Jun 13 11:36
yes... this attribute will be removed in the next version (hopefully released today)
Stijn Herreman
@stijnherreman
Jun 13 11:37
OK, I'll just use the new AddSwagger
Rico Suter
@RSuter
Jun 13 11:37
i think it's not worth fixing these issues in the old generator as it will be deprecated eventually
you need
AddSwagger() AND UseSwaggerUi3WithApiExplorer()
the first registers DI services, the latter registers the middleware
Stijn Herreman
@stijnherreman
Jun 13 11:37
right
I should have read the docs :D
Rico Suter
@RSuter
Jun 13 11:39
i know that there are way too many scenarios and ways to integrate nswag
just ping me if something small is not working so i can put it in todays release, otherwise ill release in 3 hours or so
Stijn Herreman
@stijnherreman
Jun 13 11:48
I only need a single POST method for now in this API and that's working fine. But will be migrating another more complex API next week or so, I'll report any issues on GitHub then
Rico Suter
@RSuter
Jun 13 11:53
OK thanks