Configure Swagger
The document generation configuration is done in the Startup class of your API, within the ConfigureServices(IServiceCollection services) method. A call to the extension method AddSwaggerGen(Action<SwaggerGenOptions> setupAction)
is made passing an action to generate the documentation options.
Each call to AddSwaggerGen()
will generate a new document. The parameters passed will be used to configure the rules for document generation. The output of a document generation process is a simple JSON file. By default the file(spec) will be available on /swagger/versionName/swagger.json
.
Example:
The snippet above demonstrates the usage of .AddSwaggerGen()
to register the document generation. The output of this snipped will generate a document found on the path /swagger/v1/swagger.json
.