Open joebabis opened 6 months ago
Here is the openapi document:
openapi: 3.0.0 info: version: 1.0.0 title: Some Api description: Testing oneOf paths: /somepath: post: operationId: SomeQuery requestBody: content: application/json: schema: $ref: '#/components/schemas/SomeSearchQuery' responses: '200': description: OK - Successful Response - 200 content: application/json: schema: $ref: '#/components/schemas/SomeResponse' components: schemas: SomeResponse: properties: Response: type: string SomeSearchQuery: properties: SearchBy: $ref: '#/components/schemas/SearchBy' SearchBy: oneOf: - $ref: '#/components/schemas/SearchByAddress' **No code created for this object** - $ref: '#/components/schemas/SearchByGeoLocation' properties: '@type': type: string required: - '@type' discriminator: propertyName: '@type' SearchByAddress: No code created for this object properties: SearchAddress: type: string SearchByGeoLocation: properties: SearchGeoLocation: type: string
Here is the relevant generated code:
//---------------------- // // Generated using the NSwag toolchain v14.0.2.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // //----------------------
By The Way the same thing happens in 13.0.3
blah blah blah
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.2.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class SomeSearchQuery { [Newtonsoft.Json.JsonProperty("SearchBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] **public SearchBy2 SearchBy { get; set; } ????????????????????????????????????????????** private System.Collections.Generic.IDictionary<string, object> _additionalProperties; [Newtonsoft.Json.JsonExtensionData] public System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary<string, object>()); } set { _additionalProperties = value; } } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.2.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class SearchBy { [Newtonsoft.Json.JsonProperty("@type", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Type { get; set; } private System.Collections.Generic.IDictionary<string, object> _additionalProperties; [Newtonsoft.Json.JsonExtensionData] public System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary<string, object>()); } set { _additionalProperties = value; } } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.2.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class SearchByGeoLocation { [Newtonsoft.Json.JsonProperty("SearchGeoLocation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SearchGeoLocation { get; set; } private System.Collections.Generic.IDictionary<string, object> _additionalProperties; [Newtonsoft.Json.JsonExtensionData] public System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary<string, object>()); } set { _additionalProperties = value; } } }
Here is the openapi document:
Here is the relevant generated code:
//---------------------- //
// Generated using the NSwag toolchain v14.0.2.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
//
//----------------------
By The Way the same thing happens in 13.0.3
blah blah blah
blah blah blah