diff --git a/src/Microsoft.OpenApi.OData.Reader/Common/Constants.cs b/src/Microsoft.OpenApi.OData.Reader/Common/Constants.cs index 176520c6..f3af69ba 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Common/Constants.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Common/Constants.cs @@ -95,6 +95,11 @@ internal static class Constants /// public static string xMsDiscriminatorValue = "x-ms-discriminator-value"; + /// + /// extension for navigation property + /// + public static string xMsNavigationProperty = "x-ms-navigationProperty"; + /// /// Name used for the OpenAPI referenced schema for OData Count operations responses. /// diff --git a/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs b/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs index 6d600502..0f2e667b 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs @@ -166,7 +166,7 @@ internal static bool TryAdd(this IDictionary diction /// values will be added to. /// The OData context. /// The target element. - internal static void AddCustomAtributesToExtensions(this IDictionary extensions, ODataContext context, IEdmElement element) + internal static void AddCustomAttributesToExtensions(this IDictionary extensions, ODataContext context, IEdmElement element) { if (extensions == null || context == null || @@ -175,7 +175,7 @@ internal static void AddCustomAtributesToExtensions(this IDictionary atrributesValueMap = GetCustomXMLAtrributesValueMapping(context.Model, element, context.Settings.CustomXMLAttributesMapping); + Dictionary atrributesValueMap = GetCustomXMLAttributesValueMapping(context.Model, element, context.Settings.CustomXMLAttributesMapping); if (atrributesValueMap?.Any() ?? false) { @@ -194,7 +194,7 @@ internal static void AddCustomAtributesToExtensions(this IDictionaryThe target element. /// The dictionary mapping of attribute names and extension names. /// A dictionary of extension names mapped to the custom attribute values. - private static Dictionary GetCustomXMLAtrributesValueMapping(IEdmModel model, IEdmElement element, Dictionary customXMLAttributesMapping) + private static Dictionary GetCustomXMLAttributesValueMapping(IEdmModel model, IEdmElement element, Dictionary customXMLAttributesMapping) { Dictionary atrributesValueMap = new(); diff --git a/src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs b/src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs index ca5f8faf..26270e83 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs @@ -389,7 +389,7 @@ public static IDictionary CreateStructuredTypePropertiesS { OpenApiSchema propertySchema = context.CreatePropertySchema(property); propertySchema.Description = context.Model.GetDescriptionAnnotation(property); - propertySchema.Extensions.AddCustomAtributesToExtensions(context, property); + propertySchema.Extensions.AddCustomAttributesToExtensions(context, property); properties.Add(property.Name, propertySchema); } @@ -398,7 +398,8 @@ public static IDictionary CreateStructuredTypePropertiesS { OpenApiSchema propertySchema = context.CreateEdmTypeSchema(property.Type); propertySchema.Description = context.Model.GetDescriptionAnnotation(property); - propertySchema.Extensions.AddCustomAtributesToExtensions(context, property); + propertySchema.Extensions.AddCustomAttributesToExtensions(context, property); + propertySchema.Extensions.Add(Constants.xMsNavigationProperty, new OpenApiBoolean(true)); properties.Add(property.Name, propertySchema); } diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/ComplexPropertyItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/ComplexPropertyItemHandler.cs index 6cf99c02..a0019c19 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/ComplexPropertyItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/ComplexPropertyItemHandler.cs @@ -70,6 +70,6 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetExtensions(OpenApiPathItem item) { - item.Extensions.AddCustomAtributesToExtensions(Context, ComplexProperty); + item.Extensions.AddCustomAttributesToExtensions(Context, ComplexProperty); } } \ No newline at end of file diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/EntityPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/EntityPathItemHandler.cs index b9ef9a88..cc428cb8 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/EntityPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/EntityPathItemHandler.cs @@ -55,7 +55,7 @@ protected override void SetOperations(OpenApiPathItem item) protected override void SetExtensions(OpenApiPathItem pathItem) { base.SetExtensions(pathItem); - pathItem.Extensions.AddCustomAtributesToExtensions(Context, EntitySet.EntityType()); + pathItem.Extensions.AddCustomAttributesToExtensions(Context, EntitySet.EntityType()); } } } diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/EntitySetPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/EntitySetPathItemHandler.cs index 346fafc7..29450c37 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/EntitySetPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/EntitySetPathItemHandler.cs @@ -60,7 +60,7 @@ protected override void SetBasicInfo(OpenApiPathItem pathItem) protected override void SetExtensions(OpenApiPathItem pathItem) { base.SetExtensions(pathItem); - pathItem.Extensions.AddCustomAtributesToExtensions(Context, EntitySet); + pathItem.Extensions.AddCustomAttributesToExtensions(Context, EntitySet); } } } diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/NavigationPropertyPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/NavigationPropertyPathItemHandler.cs index 4f402cce..5c037952 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/NavigationPropertyPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/NavigationPropertyPathItemHandler.cs @@ -266,7 +266,7 @@ protected override void SetExtensions(OpenApiPathItem item) } base.SetExtensions(item); - item.Extensions.AddCustomAtributesToExtensions(Context, NavigationProperty); + item.Extensions.AddCustomAttributesToExtensions(Context, NavigationProperty); } /// protected override void SetBasicInfo(OpenApiPathItem pathItem) diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs index d204e06e..becbb2d6 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs @@ -45,6 +45,6 @@ protected override void SetBasicInfo(OpenApiPathItem pathItem) protected override void SetExtensions(OpenApiPathItem pathItem) { base.SetExtensions(pathItem); - pathItem.Extensions.AddCustomAtributesToExtensions(Context, StructuredType); + pathItem.Extensions.AddCustomAttributesToExtensions(Context, StructuredType); } } diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationImportPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationImportPathItemHandler.cs index c94f3161..9ab0bd3b 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationImportPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationImportPathItemHandler.cs @@ -71,7 +71,7 @@ protected override void SetBasicInfo(OpenApiPathItem pathItem) protected override void SetExtensions(OpenApiPathItem item) { base.SetExtensions(item); - item.Extensions.AddCustomAtributesToExtensions(Context, EdmOperationImport); + item.Extensions.AddCustomAttributesToExtensions(Context, EdmOperationImport); } } } diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationPathItemHandler.cs index d3ea0b10..f527238e 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/OperationPathItemHandler.cs @@ -95,7 +95,7 @@ protected override void SetExtensions(OpenApiPathItem item) } base.SetExtensions(item); - item.Extensions.AddCustomAtributesToExtensions(Context, EdmOperation); + item.Extensions.AddCustomAttributesToExtensions(Context, EdmOperation); } /// diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/SingletonPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/SingletonPathItemHandler.cs index cae8e092..6ffbc66c 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/SingletonPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/SingletonPathItemHandler.cs @@ -62,7 +62,7 @@ protected override void SetBasicInfo(OpenApiPathItem pathItem) protected override void SetExtensions(OpenApiPathItem pathItem) { base.SetExtensions(pathItem); - pathItem.Extensions.AddCustomAtributesToExtensions(Context, Singleton); + pathItem.Extensions.AddCustomAttributesToExtensions(Context, Singleton); } } } diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs index d7a8e42a..7445c270 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs @@ -305,7 +305,8 @@ public void CreateStructuredTypePropertiesSchemaWithCustomAttributeReturnsCorrec ""nullable"": true } ], - ""x-ms-isHidden"": ""true"" + ""x-ms-isHidden"": ""true"", + ""x-ms-navigationProperty"": true }, ""regionalAndLanguageSettings"": { ""anyOf"": [ @@ -316,7 +317,8 @@ public void CreateStructuredTypePropertiesSchemaWithCustomAttributeReturnsCorrec ""type"": ""object"", ""nullable"": true } - ] + ], + ""x-ms-navigationProperty"": true }, ""shiftPreferences"": { ""anyOf"": [ @@ -327,7 +329,8 @@ public void CreateStructuredTypePropertiesSchemaWithCustomAttributeReturnsCorrec ""type"": ""object"", ""nullable"": true } - ] + ], + ""x-ms-navigationProperty"": true } } } @@ -524,7 +527,8 @@ public void CreateEntityTypeWithoutBaseSchemaReturnCorrectSchema() ""type"": ""array"", ""items"": { ""$ref"": ""#/components/schemas/NS.Creature"" - } + }, + ""x-ms-navigationProperty"": true } }, ""description"": ""Entity type 'Zoo' description."", diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.json index 6156f0cb..e78828da 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.json +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.json @@ -3940,7 +3940,8 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.App.DTO.RevisionDto" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -4046,7 +4047,8 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.App.DTO.DocumentDto" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -4483,13 +4485,15 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true }, "Revisions": { "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Revision.Revision" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -4915,19 +4919,22 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true }, "LibraryChildren": { "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.Library" - } + }, + "x-ms-navigationProperty": true }, "SourceLibraryChildren": { "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.Library" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -5078,13 +5085,15 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType" - } + }, + "x-ms-navigationProperty": true }, "ChildrenLibraryTypes": { "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -5213,7 +5222,8 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -5344,7 +5354,8 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true } } } @@ -5378,7 +5389,8 @@ "type": "array", "items": { "$ref": "#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true } } } diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.yaml index d550c91b..7337721e 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.yaml +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.V2.yaml @@ -2833,6 +2833,7 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.App.DTO.RevisionDto' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -2913,6 +2914,7 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.App.DTO.DocumentDto' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -3256,10 +3258,12 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true Revisions: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Revision.Revision' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -3599,14 +3603,17 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true LibraryChildren: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.Library' + x-ms-navigationProperty: true SourceLibraryChildren: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.Library' + x-ms-navigationProperty: true example: Id: integer (identifier) DomainId: integer @@ -3725,10 +3732,12 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType' + x-ms-navigationProperty: true ChildrenLibraryTypes: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -3828,6 +3837,7 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -3924,6 +3934,7 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true example: Id: integer (identifier) DomainId: integer @@ -3945,6 +3956,7 @@ definitions: type: array items: $ref: '#/definitions/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true example: Id: integer (identifier) DomainId: integer diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json index 84243e81..82655d1e 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json @@ -4536,7 +4536,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.App.DTO.RevisionDto" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -4648,7 +4649,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.App.DTO.DocumentDto" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -4779,7 +4781,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true } }, "example": { @@ -5148,7 +5151,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "LastRevisionFile": { "anyOf": [ @@ -5159,7 +5163,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "SourceDocument": { "anyOf": [ @@ -5170,19 +5175,22 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "SourceDocumentChildren": { "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true }, "Revisions": { "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Revision.Revision" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -5317,7 +5325,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true } }, "example": { @@ -5387,7 +5396,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "Tag": { "anyOf": [ @@ -5398,7 +5408,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true } }, "example": { @@ -5647,7 +5658,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "Type": { "anyOf": [ @@ -5658,7 +5670,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "SourceFolder": { "anyOf": [ @@ -5669,25 +5682,29 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "Documents": { "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true }, "LibraryChildren": { "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library" - } + }, + "x-ms-navigationProperty": true }, "SourceLibraryChildren": { "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -5844,7 +5861,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "ParentLibraryTypes": { "anyOf": [ @@ -5855,19 +5873,22 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "MasterLibraryTypeChildren": { "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType" - } + }, + "x-ms-navigationProperty": true }, "ChildrenLibraryTypes": { "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -6005,7 +6026,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true } }, "example": { @@ -6146,7 +6168,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true } } } @@ -6180,7 +6203,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document" - } + }, + "x-ms-navigationProperty": true } } } @@ -6376,7 +6400,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true } }, "example": { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml index 276536aa..a0d60db9 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml @@ -3249,6 +3249,7 @@ components: type: array items: $ref: '#/components/schemas/Siterra.Documents.App.DTO.RevisionDto' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -3335,6 +3336,7 @@ components: type: array items: $ref: '#/components/schemas/Siterra.Documents.App.DTO.DocumentDto' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -3437,6 +3439,7 @@ components: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' - type: object nullable: true + x-ms-navigationProperty: true example: Id: integer (identifier) Number: integer @@ -3725,24 +3728,29 @@ components: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library' - type: object nullable: true + x-ms-navigationProperty: true LastRevisionFile: anyOf: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.DocumentFile.DocumentFile' - type: object nullable: true + x-ms-navigationProperty: true SourceDocument: anyOf: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' - type: object nullable: true + x-ms-navigationProperty: true SourceDocumentChildren: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true Revisions: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Revision.Revision' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -3846,6 +3854,7 @@ components: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' - type: object nullable: true + x-ms-navigationProperty: true example: ClassInstance: integer ClassId: integer @@ -3899,11 +3908,13 @@ components: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' - type: object nullable: true + x-ms-navigationProperty: true Tag: anyOf: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Tags.Tag' - type: object nullable: true + x-ms-navigationProperty: true example: DocumentId: integer TagId: integer @@ -4105,28 +4116,34 @@ components: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library' - type: object nullable: true + x-ms-navigationProperty: true Type: anyOf: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType' - type: object nullable: true + x-ms-navigationProperty: true SourceFolder: anyOf: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library' - type: object nullable: true + x-ms-navigationProperty: true Documents: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true LibraryChildren: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library' + x-ms-navigationProperty: true SourceLibraryChildren: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library' + x-ms-navigationProperty: true example: Id: integer (identifier) DomainId: integer @@ -4249,19 +4266,23 @@ components: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType' - type: object nullable: true + x-ms-navigationProperty: true ParentLibraryTypes: anyOf: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType' - type: object nullable: true + x-ms-navigationProperty: true MasterLibraryTypeChildren: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType' + x-ms-navigationProperty: true ChildrenLibraryTypes: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -4370,6 +4391,7 @@ components: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true example: Id: integer (identifier) Name: string @@ -4471,6 +4493,7 @@ components: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true example: Id: integer (identifier) DomainId: integer @@ -4492,6 +4515,7 @@ components: type: array items: $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' + x-ms-navigationProperty: true example: Id: integer (identifier) DomainId: integer @@ -4642,6 +4666,7 @@ components: - $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document' - type: object nullable: true + x-ms-navigationProperty: true example: Id: integer (identifier) Number: integer diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json index a1ef01af..7d23d023 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json @@ -26012,7 +26012,8 @@ "type": "array", "items": { "$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" - } + }, + "x-ms-navigationProperty": true }, "BestFriend": { "$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" @@ -26022,7 +26023,8 @@ "type": "array", "items": { "$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip" - } + }, + "x-ms-navigationProperty": true } } }, @@ -26168,7 +26170,8 @@ "type": "array", "items": { "$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.PlanItem" - } + }, + "x-ms-navigationProperty": true } } }, @@ -26284,7 +26287,8 @@ "type": "array", "items": { "$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" - } + }, + "x-ms-navigationProperty": true } } } @@ -26315,7 +26319,8 @@ "type": "array", "items": { "$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" - } + }, + "x-ms-navigationProperty": true } } } diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml index 16460bd3..88534ace 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml @@ -18480,6 +18480,7 @@ definitions: type: array items: $ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' + x-ms-navigationProperty: true BestFriend: $ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' Trips: @@ -18487,6 +18488,7 @@ definitions: type: array items: $ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip' + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline: title: Airline type: object @@ -18581,6 +18583,7 @@ definitions: type: array items: $ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.PlanItem' + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.PlanItem: title: PlanItem type: object @@ -18651,6 +18654,7 @@ definitions: type: array items: $ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.Manager: allOf: - $ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' @@ -18668,6 +18672,7 @@ definitions: type: array items: $ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender: title: PersonGender description: Gender of the person. diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json index f48739c5..a7c6d210 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json @@ -29680,7 +29680,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" - } + }, + "x-ms-navigationProperty": true }, "BestFriend": { "anyOf": [ @@ -29692,14 +29693,16 @@ "nullable": true } ], - "description": "The best friend." + "description": "The best friend.", + "x-ms-navigationProperty": true }, "Trips": { "type": "array", "items": { "$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip" }, - "description": "Collection of trips." + "description": "Collection of trips.", + "x-ms-navigationProperty": true } } }, @@ -29805,7 +29808,8 @@ "nullable": true } ], - "description": "The person to contact in case of a crisis at this location." + "description": "The person to contact in case of a crisis at this location.", + "x-ms-navigationProperty": true } } } @@ -29886,7 +29890,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.PlanItem" - } + }, + "x-ms-navigationProperty": true } } }, @@ -29988,7 +29993,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "From": { "anyOf": [ @@ -29999,7 +30005,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true }, "To": { "anyOf": [ @@ -30010,7 +30017,8 @@ "type": "object", "nullable": true } - ] + ], + "x-ms-navigationProperty": true } } } @@ -30040,7 +30048,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" - } + }, + "x-ms-navigationProperty": true } } } @@ -30081,7 +30090,8 @@ "type": "array", "items": { "$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" - } + }, + "x-ms-navigationProperty": true } } } diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml index 70302be7..11f50805 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml @@ -21035,17 +21035,20 @@ components: type: array items: $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' + x-ms-navigationProperty: true BestFriend: anyOf: - $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' - type: object nullable: true description: The best friend. + x-ms-navigationProperty: true Trips: type: array items: $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip' description: Collection of trips. + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline: title: Airline type: object @@ -21111,6 +21114,7 @@ components: - type: object nullable: true description: The person to contact in case of a crisis at this location. + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.EventLocation: allOf: - $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Location' @@ -21162,6 +21166,7 @@ components: type: array items: $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.PlanItem' + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.PlanItem: title: PlanItem type: object @@ -21223,16 +21228,19 @@ components: - $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline' - type: object nullable: true + x-ms-navigationProperty: true From: anyOf: - $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport' - type: object nullable: true + x-ms-navigationProperty: true To: anyOf: - $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport' - type: object nullable: true + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.Employee: allOf: - $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' @@ -21248,6 +21256,7 @@ components: type: array items: $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.Manager: allOf: - $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' @@ -21268,6 +21277,7 @@ components: type: array items: $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person' + x-ms-navigationProperty: true Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender: title: PersonGender enum: