The purpose of this issue is to align the code produced by the ATC REST API Generator to be as close as possible to what is defined in the OpenAPI specifications document in terms of how Swagger UI is rendered. A good way of testing this is to use the Swagger Petstore v3 example specification, which has become the standard specifications document to test against used when building code generators
Here are some screenshots that indicate some pretty obvious differences between the original Swagger Petstore v3 rendered by https://petstore3.swagger.io (or https://editor.swagger.io) and the ATC generated code renders Swagger UI
Implementing missing Info metadata
The OpenAPI Info object is represented by the Microsoft.OpenApi.Models.OpenApiInfo class and is used when configuring SwaggerGenOptions
Example usage:
public void ConfigureServices(IServiceCollection services)
{
services
.AddSwaggerGen(c =>
{
c.SwaggerDoc("1.0.5", new OpenApiInfo
{
Version = "1.0.5",
Title = "Swagger Petstore - OpenAPI 3.0",
Description = "Swagger Petstore - OpenAPI 3.0 (ASP.NET Core 3.1)",
Contact = new OpenApiContact()
{
Name = "Swagger Codegen Contributors",
Url = new Uri("https://github.com/swagger-api/swagger-codegen"),
Email = "apiteam@swagger.io"
},
TermsOfService = new Uri("http://swagger.io/terms/")
});
});
}
The correct way of doing this is by implementing IConfigureOptions<SwaggerGenOptions> so that developers can have multiple implementations of IConfigureOptions<SwaggerGenOptions> whereas using the AddSwaggerGen extension method will prevent IConfigureOptions<SwaggerGenOptions> implementations from being called
The purpose of this issue is to align the code produced by the ATC REST API Generator to be as close as possible to what is defined in the OpenAPI specifications document in terms of how Swagger UI is rendered. A good way of testing this is to use the Swagger Petstore v3 example specification, which has become the standard specifications document to test against used when building code generators
Tasks:
Swagger UI differences
Here are some screenshots that indicate some pretty obvious differences between the original Swagger Petstore v3 rendered by https://petstore3.swagger.io (or https://editor.swagger.io) and the ATC generated code renders Swagger UI
Implementing missing Info metadata
The OpenAPI Info object is represented by the
Microsoft.OpenApi.Models.OpenApiInfo
class and is used when configuringSwaggerGenOptions
Example usage:
The correct way of doing this is by implementing
IConfigureOptions<SwaggerGenOptions>
so that developers can have multiple implementations ofIConfigureOptions<SwaggerGenOptions>
whereas using theAddSwaggerGen
extension method will preventIConfigureOptions<SwaggerGenOptions>
implementations from being called