Example of an ASP.NET Core API.
Repo features:
- Initialisation script for quick namespace adjustment.
- Use of NSwag to automatically document endpoints and to generate client code for
an interop package.
- Recommended next step: Exporting the interop package as a NuGet for use in other projects.
- Configuration is based on environment variables.
To change the namespace of the API en-masse for your purposes, use the init-repo.sh script:
bash init-repo.sh New.Namespace.HereFor local testing, see the test/local folder.
Rough citation of some sources beyond memory.
- RicoSuter/NSwag#2409 - on models not showing up
- https://github.com/RicoSuter/NSwag/wiki/NSwag.MSBuild
- https://stackoverflow.com/questions/33283071/swagger-webapi-create-json-on-build
- https://github.com/RicoSuter/NSwag/wiki/CommandLine/ce950c5aea7bf52a85ec6e517ad8ea96762181ed
- RicoSuter/NSwag#1573
- Should use aspnetcore2swagger
- RicoSuter/NSwag#3119
- Use nobuild to avoid infinite build loop
- https://github.com/RicoSuter/NSwag/wiki/NSwag-Configuration-Document
- Doesn't include sourcing from an existing swagger.json though...
- Derived 'Net80' runtime from phrasing in EXE variable
- https://stackoverflow.com/questions/63791017/generate-with-nswag-an-openapi-document-including-swashbuckle-custom-operation-f
- Describes fromDocument section
- Derive from Url, but we want path
- https://stackoverflow.com/questions/73016248/generating-c-sharp-api-client-with-nswag-msbuild\
- Derive from Json
- https://stackoverflow.com/questions/59393267/generate-nswag-client-as-part-of-the-build
- Mentions rigging up before build
- https://github.com/RicoSuter/NSwag/wiki/AspNetCoreOpenApiDocumentGenerator
- https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs
- https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.Commands/Commands/OutputCommandBase.cs