forked from loafle/openapi-generator-original
		
	Added support for inheritance in Swashbuckle in ASP.NET Core (#12856)
* Added support for inheritance in Swashbuckle * Updated to new API
This commit is contained in:
		
							parent
							
								
									2248baa5ea
								
							
						
					
					
						commit
						17c021df5b
					
				| @ -86,6 +86,8 @@ namespace {{packageName}} | ||||
|             services | ||||
|                 .AddSwaggerGen(c => | ||||
|                 { | ||||
|                     c.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); | ||||
|                      | ||||
|                     c.SwaggerDoc("{{{version}}}{{^version}}v1{{/version}}", new OpenApiInfo | ||||
|                     { | ||||
|                         Title = "{{{appName}}}{{^appName}}{{packageName}}{{/appName}}", | ||||
|  | ||||
| @ -11,6 +11,7 @@ using Newtonsoft.Json; | ||||
| {{#model}} | ||||
| {{#discriminator}} | ||||
| using JsonSubTypes; | ||||
| using Swashbuckle.AspNetCore.Annotations; | ||||
| {{/discriminator}} | ||||
| {{/model}} | ||||
| {{/models}} | ||||
| @ -26,8 +27,10 @@ namespace {{modelPackage}} | ||||
|     [DataContract] | ||||
|     {{#discriminator}} | ||||
|     [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")] | ||||
|     [SwaggerDiscriminator("{{{discriminatorName}}}")] | ||||
|     {{#mappedModels}} | ||||
|     [JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")] | ||||
|     [SwaggerSubType(typeof({{{modelName}}}), DiscriminatorValue =  "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")] | ||||
|     {{/mappedModels}} | ||||
|     {{/discriminator}} | ||||
|     public {{#modelClassModifier}}{{.}} {{/modelClassModifier}}class {{classname}} {{#parent}}: {{{.}}}{{^pocoModels}}, {{/pocoModels}}{{/parent}}{{^pocoModels}}{{^parent}}: {{/parent}}IEquatable<{{classname}}>{{/pocoModels}} | ||||
|  | ||||
| @ -80,6 +80,8 @@ namespace Org.OpenAPITools | ||||
|             services | ||||
|                 .AddSwaggerGen(c => | ||||
|                 { | ||||
|                     c.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); | ||||
|                      | ||||
|                     c.SwaggerDoc("1.0.0", new OpenApiInfo | ||||
|                     { | ||||
|                         Title = "OpenAPI Petstore", | ||||
|  | ||||
| @ -80,6 +80,8 @@ namespace Org.OpenAPITools | ||||
|             services | ||||
|                 .AddSwaggerGen(c => | ||||
|                 { | ||||
|                     c.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); | ||||
|                      | ||||
|                     c.SwaggerDoc("1.0.0", new OpenApiInfo | ||||
|                     { | ||||
|                         Title = "OpenAPI Petstore", | ||||
|  | ||||
| @ -80,6 +80,8 @@ namespace Org.OpenAPITools | ||||
|             services | ||||
|                 .AddSwaggerGen(c => | ||||
|                 { | ||||
|                     c.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); | ||||
|                      | ||||
|                     c.SwaggerDoc("1.0.0", new OpenApiInfo | ||||
|                     { | ||||
|                         Title = "OpenAPI Petstore", | ||||
|  | ||||
| @ -80,6 +80,8 @@ namespace Org.OpenAPITools | ||||
|             services | ||||
|                 .AddSwaggerGen(c => | ||||
|                 { | ||||
|                     c.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); | ||||
|                      | ||||
|                     c.SwaggerDoc("1.0.0", new OpenApiInfo | ||||
|                     { | ||||
|                         Title = "OpenAPI Petstore", | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user