forked from loafle/openapi-generator-original
Added support for VERSION, APPNAME and CONTACT from Swagger file into Startup.cs (#7103)
* Added support for VERSION and APPNAME from Swagger file into Startup.cs for Swashbuckle SwaggerGen * Ran bin/aspnetcore-petstore-server.sh * Added contact information * Added contact information to startup.cs
This commit is contained in:
@@ -54,11 +54,17 @@ namespace {{packageName}}
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new Info
|
||||
c.SwaggerDoc("{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}", new Info
|
||||
{
|
||||
Version = "v1",
|
||||
Title = "{{packageName}}",
|
||||
Description = "{{packageName}} (ASP.NET Core 2.0)"
|
||||
Version = "{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}",
|
||||
Title = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}",
|
||||
Description = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} (ASP.NET Core 2.0)",
|
||||
Contact = new Contact()
|
||||
{
|
||||
Url = "{{#infoUrl}}{{{infoUrl}}}{{/infoUrl}}",
|
||||
Email = "{{#infoEmail}}{{{infoEmail}}}{{/infoEmail}}"
|
||||
},
|
||||
TermsOfService = "{{#termsOfService}}{{{termsOfService}}}{{/termsOfService}}"
|
||||
});
|
||||
c.CustomSchemaIds(type => type.FriendlyId(true));
|
||||
c.DescribeAllEnumsAsStrings();
|
||||
@@ -87,7 +93,7 @@ namespace {{packageName}}
|
||||
.UseSwagger()
|
||||
.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "{{packageName}}");
|
||||
c.SwaggerEndpoint("/swagger/{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}/swagger.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}");
|
||||
});
|
||||
|
||||
if (env.IsDevelopment())
|
||||
|
||||
@@ -63,11 +63,17 @@ namespace IO.Swagger
|
||||
services
|
||||
.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new Info
|
||||
c.SwaggerDoc("1.0.0", new Info
|
||||
{
|
||||
Version = "v1",
|
||||
Title = "IO.Swagger",
|
||||
Description = "IO.Swagger (ASP.NET Core 2.0)"
|
||||
Version = "1.0.0",
|
||||
Title = "Swagger Petstore",
|
||||
Description = "Swagger Petstore (ASP.NET Core 2.0)",
|
||||
Contact = new Contact()
|
||||
{
|
||||
Url = "",
|
||||
Email = "apiteam@swagger.io"
|
||||
},
|
||||
TermsOfService = "http://swagger.io/terms/"
|
||||
});
|
||||
c.CustomSchemaIds(type => type.FriendlyId(true));
|
||||
c.DescribeAllEnumsAsStrings();
|
||||
@@ -94,7 +100,7 @@ namespace IO.Swagger
|
||||
.UseSwagger()
|
||||
.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "IO.Swagger");
|
||||
c.SwaggerEndpoint("/swagger/1.0.0/swagger.json", "Swagger Petstore");
|
||||
});
|
||||
|
||||
if (env.IsDevelopment())
|
||||
|
||||
Reference in New Issue
Block a user