3 ms·
I think for swagger documentation you install the swashbuckle nuget package and then add these three lines services.AddSwaggerGen(); app.UseSwagger(); app.U
by JamesBarney 4y ago
I think for swagger documentation you install the swashbuckle nuget package and then add these three lines
services.AddSwaggerGen();
app.UseSwagger();
app.UseSwaggerUI();
- silon42 4y agoPersonally, I'd rather generate documentation at compile time.
- wizofaus 4y agoWhich you can do, by adding a post build step.
- piaste 4y agoI do it during tests. Since I'm already spawning a TestHost and trying out various API calls, one of these tests basically does "curl $host/openapi/openapi.json | diff ./docs/openapi.json". If it spots a change and fails the test, I check that the difference is expected, and if so I temporarily enable and run a different "test" which actually writes the updated file.
- orthoxerox 4y agoASP.NET configuration is one of the most arcane parts of .NET that I don't like. You have to perform the incantation thrice: add package reference, add service reference, invoke the builder extension. And there's the right order and the wrong order of invocations, and if you pick the wrong one, your app silently won't work correctly.
- metaltyphoon 4y agoArcane? What did you expect? Add a package and magically everything works? If you make it work by just adding a reference its “too much magic”, if you make it so people write everything “it’s boilerplate” and if you do something in between “its arcane”.