From 9de1b3844e142c0e4b3509d961785a685958cab7 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Tue, 20 Jul 2021 12:45:45 +0300 Subject: [PATCH 1/9] Generate collection nav. prop. entity paths for non-contained nav. props --- .../Edm/ODataPathProvider.cs | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs index f3be3ad4..2cb55033 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs @@ -271,8 +271,21 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr // Check whether a collection-valued navigation property should be indexed by key value(s). NavigationPropertyRestriction restriction = navigation?.RestrictedProperties?.FirstOrDefault(); + if (restriction == null || restriction.IndexableByKey == true) { + IEdmEntityType navEntityType = navigationProperty.ToEntityType(); + + if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + // Append a navigation property key. + currentPath.Push(new ODataKeySegment(navEntityType)); + AppendPath(currentPath.Clone()); + } + + // Get possible stream paths for the navigation entity type + RetrieveMediaEntityStreamPaths(navEntityType, currentPath); + if (!navigationProperty.ContainsTarget) { // Non-Contained @@ -284,26 +297,6 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr } else { - IEdmEntityType navEntityType = navigationProperty.ToEntityType(); - - // append a navigation property key. - if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) - { - currentPath.Push(new ODataKeySegment(navEntityType)); - AppendPath(currentPath.Clone()); - - if (!navigationProperty.ContainsTarget) - { - // TODO: Shall we add "$ref" after {key}, and only support delete? - // ODataPath newPath = currentPath.Clone(); - // newPath.Push(ODataRefSegment.Instance); // $ref - // AppendPath(newPath); - } - } - - // Get possible navigation property stream paths - RetrieveMediaEntityStreamPaths(navEntityType, currentPath); - if (shouldExpand) { // expand to sub navigation properties @@ -315,11 +308,11 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr } } } + } - if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) - { - currentPath.Pop(); - } + if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + currentPath.Pop(); } } currentPath.Pop(); From a24194df63a2e1c3af4def71e8417f771535b434 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Wed, 21 Jul 2021 14:10:14 +0300 Subject: [PATCH 2/9] Revert previous changes --- .../Edm/ODataPathProvider.cs | 50 +++++++++++++------ .../PathItem/RefPathItemHandler.cs | 2 + 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs index 2cb55033..f35f065b 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs @@ -274,17 +274,14 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr if (restriction == null || restriction.IndexableByKey == true) { - IEdmEntityType navEntityType = navigationProperty.ToEntityType(); + // IEdmEntityType navEntityType = navigationProperty.ToEntityType(); - if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) - { - // Append a navigation property key. - currentPath.Push(new ODataKeySegment(navEntityType)); - AppendPath(currentPath.Clone()); - } - - // Get possible stream paths for the navigation entity type - RetrieveMediaEntityStreamPaths(navEntityType, currentPath); + //if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + //{ + // // Append a navigation property key. + // currentPath.Push(new ODataKeySegment(navEntityType)); + // AppendPath(currentPath.Clone()); + //} if (!navigationProperty.ContainsTarget) { @@ -294,9 +291,34 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr ODataPath newPath = currentPath.Clone(); newPath.Push(ODataRefSegment.Instance); // $ref AppendPath(newPath); + + if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + + } } else { + IEdmEntityType navEntityType = navigationProperty.ToEntityType(); + + // append a navigation property key. + if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + currentPath.Push(new ODataKeySegment(navEntityType)); + AppendPath(currentPath.Clone()); + + if (!navigationProperty.ContainsTarget) + { + // TODO: Shall we add "$ref" after {key}, and only support delete? + // ODataPath newPath = currentPath.Clone(); + // newPath.Push(ODataRefSegment.Instance); // $ref + // AppendPath(newPath); + } + } + + // Get possible stream paths for the navigation entity type + RetrieveMediaEntityStreamPaths(navEntityType, currentPath); + if (shouldExpand) { // expand to sub navigation properties @@ -308,11 +330,11 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr } } } - } - if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) - { - currentPath.Pop(); + if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + currentPath.Pop(); + } } } currentPath.Pop(); diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs index 60a18bf2..6b89c9ba 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs @@ -84,6 +84,8 @@ protected override void SetOperations(OpenApiPathItem item) { AddOperation(item, OperationType.Post); } + + // TODO: Add delete operation } else { From ea41969784db8fcf9ff56938afc4e94e9d37d6ab Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Thu, 22 Jul 2021 01:08:11 +0300 Subject: [PATCH 3/9] Paths with DELETE operations for collection-valued nav. prop. $ref paths --- .../Edm/ODataPathProvider.cs | 66 +++++++++-------- .../PathItem/RefPathItemHandler.cs | 71 ++++++++++++------- 2 files changed, 84 insertions(+), 53 deletions(-) diff --git a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs index f35f065b..4f1a5093 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs @@ -274,46 +274,32 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr if (restriction == null || restriction.IndexableByKey == true) { - // IEdmEntityType navEntityType = navigationProperty.ToEntityType(); - - //if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) - //{ - // // Append a navigation property key. - // currentPath.Push(new ODataKeySegment(navEntityType)); - // AppendPath(currentPath.Clone()); - //} + IEdmEntityType navEntityType = navigationProperty.ToEntityType(); if (!navigationProperty.ContainsTarget) { // Non-Contained - // Single-Valued: DELETE ~/entityset/{key}/single-valued-Nav/$ref - // collection-valued: DELETE ~/entityset/{key}/collection-valued-Nav/$ref?$id ={ navKey} - ODataPath newPath = currentPath.Clone(); - newPath.Push(ODataRefSegment.Instance); // $ref - AppendPath(newPath); + // Single-Valued: ~/entityset/{key}/single-valued-Nav/$ref + // Collection-valued: ~/entityset/{key}/collection-valued-Nav/$ref?$id ={navKey} + CreateRefPath(currentPath); if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { + CreateEntityPath(navEntityType, currentPath); + // Collection-valued: DELETE ~/entityset/{key}/collection-valued-Nav/{key}/$ref + CreateRefPath(currentPath); } + + // Get possible stream paths for the navigation entity type + RetrieveMediaEntityStreamPaths(navEntityType, currentPath); } else { - IEdmEntityType navEntityType = navigationProperty.ToEntityType(); - // append a navigation property key. if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { - currentPath.Push(new ODataKeySegment(navEntityType)); - AppendPath(currentPath.Clone()); - - if (!navigationProperty.ContainsTarget) - { - // TODO: Shall we add "$ref" after {key}, and only support delete? - // ODataPath newPath = currentPath.Clone(); - // newPath.Push(ODataRefSegment.Instance); // $ref - // AppendPath(newPath); - } + CreateEntityPath(navEntityType, currentPath); } // Get possible stream paths for the navigation entity type @@ -330,11 +316,11 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr } } } + } - if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) - { - currentPath.Pop(); - } + if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + currentPath.Pop(); } } currentPath.Pop(); @@ -364,6 +350,28 @@ private bool ShouldExpandNavigationProperty(IEdmNavigationProperty navigationPro return true; } + /// + /// Create $ref paths. + /// + /// The current OData path. + private void CreateRefPath(ODataPath currentPath) + { + ODataPath newPath = currentPath.Clone(); + newPath.Push(ODataRefSegment.Instance); // $ref + AppendPath(newPath); + } + + /// + /// Create entity paths. + /// + /// The entity type. + /// The current OData path. + private void CreateEntityPath(IEdmEntityType entityType, ODataPath currentPath) + { + currentPath.Push(new ODataKeySegment(entityType)); + AppendPath(currentPath.Clone()); + } + /// /// Retrieve all bounding . /// diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs index 6b89c9ba..515de854 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs @@ -68,39 +68,62 @@ protected override void SetOperations(OpenApiPathItem item) // So far, we only consider the non-containment Debug.Assert(!NavigationProperty.ContainsTarget); - // It seems OData supports to "GetRef, DeleteRef", - // Here at this time,let's only consider the "delete" - ReadRestrictionsType read = restriction?.ReadRestrictions; - if (read == null || read.IsReadable) - { - AddOperation(item, OperationType.Get); - } - // Create the ref if (NavigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { - InsertRestrictionsType insert = restriction?.InsertRestrictions; - if (insert == null || insert.IsInsertable) + ODataSegment penultimateSegment = Path.Segments.Reverse().Skip(1).First(); + if (penultimateSegment is ODataKeySegment) { - AddOperation(item, OperationType.Post); + // Collection-valued: DELETE ~/entityset/{key}/collection-valued-Nav/{key}/$ref + AddDeleteOperation(item, restriction); + } + else + { + AddReadOperation(item, restriction); + AddInsertOperation(item, restriction); } - - // TODO: Add delete operation } else { - UpdateRestrictionsType update = restriction?.UpdateRestrictions; - if (update == null || update.IsUpdatable) - { - AddOperation(item, OperationType.Put); - } + AddReadOperation(item, restriction); + AddUpdateOperation(item, restriction); + AddDeleteOperation(item, restriction); + } + } - // delete the link - DeleteRestrictionsType delete = restriction?.DeleteRestrictions; - if (delete == null || delete.IsDeletable) - { - AddOperation(item, OperationType.Delete); - } + private void AddDeleteOperation(OpenApiPathItem item, NavigationPropertyRestriction restriction) + { + DeleteRestrictionsType delete = restriction?.DeleteRestrictions; + if (delete == null || delete.IsDeletable) + { + AddOperation(item, OperationType.Delete); + } + } + + private void AddReadOperation(OpenApiPathItem item, NavigationPropertyRestriction restriction) + { + ReadRestrictionsType read = restriction?.ReadRestrictions; + if (read == null || read.IsReadable) + { + AddOperation(item, OperationType.Get); + } + } + + private void AddInsertOperation(OpenApiPathItem item, NavigationPropertyRestriction restriction) + { + InsertRestrictionsType insert = restriction?.InsertRestrictions; + if (insert == null || insert.IsInsertable) + { + AddOperation(item, OperationType.Post); + } + } + + private void AddUpdateOperation(OpenApiPathItem item, NavigationPropertyRestriction restriction) + { + UpdateRestrictionsType update = restriction?.UpdateRestrictions; + if (update == null || update.IsUpdatable) + { + AddOperation(item, OperationType.Put); } } From 902f43fc1ccc35e2a8bee2b82a3ef375b57ddc15 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Mon, 2 Aug 2021 18:44:54 +0300 Subject: [PATCH 4/9] Don't create extra path for OData Key segment when creating DELETE for $ref --- .../Edm/ODataPathProvider.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs index 4f1a5093..062f61c0 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs @@ -285,9 +285,8 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { - CreateEntityPath(navEntityType, currentPath); - // Collection-valued: DELETE ~/entityset/{key}/collection-valued-Nav/{key}/$ref + currentPath.Push(new ODataKeySegment(navEntityType)); CreateRefPath(currentPath); } @@ -299,7 +298,8 @@ private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationPr // append a navigation property key. if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { - CreateEntityPath(navEntityType, currentPath); + currentPath.Push(new ODataKeySegment(navEntityType)); + AppendPath(currentPath.Clone()); } // Get possible stream paths for the navigation entity type @@ -361,17 +361,6 @@ private void CreateRefPath(ODataPath currentPath) AppendPath(newPath); } - /// - /// Create entity paths. - /// - /// The entity type. - /// The current OData path. - private void CreateEntityPath(IEdmEntityType entityType, ODataPath currentPath) - { - currentPath.Push(new ODataKeySegment(entityType)); - AppendPath(currentPath.Clone()); - } - /// /// Retrieve all bounding . /// From 633d6fcfb8461ba52c0171fd4da3f24ce40f087d Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Mon, 2 Aug 2021 18:45:16 +0300 Subject: [PATCH 5/9] Update tests --- .../Edm/ODataPathProviderTests.cs | 7 ++++--- .../PathItem/RefPathItemHandlerTests.cs | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs index 00f4eb1a..436ac656 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs @@ -48,7 +48,7 @@ public void GetPathsForGraphBetaModelReturnsAllPaths() // Assert Assert.NotNull(paths); - Assert.Equal(17313, paths.Count()); + Assert.Equal(17401, paths.Count()); } [Fact] @@ -67,7 +67,7 @@ public void GetPathsForGraphBetaModelWithDerivedTypesConstraintReturnsAllPaths() // Assert Assert.NotNull(paths); - Assert.Equal(13642, paths.Count()); + Assert.Equal(13730, paths.Count()); } [Fact] @@ -409,13 +409,14 @@ public void GetPathsWithNonContainedNavigationPropertyWorks() // Assert Assert.NotNull(paths); - Assert.Equal(8, paths.Count()); + Assert.Equal(9, paths.Count()); var pathItems = paths.Select(p => p.GetPathItemName()).ToList(); Assert.Contains("/Orders({id})/MultipleCustomers", pathItems); Assert.Contains("/Orders({id})/SingleCustomer", pathItems); Assert.Contains("/Orders({id})/SingleCustomer/$ref", pathItems); Assert.Contains("/Orders({id})/MultipleCustomers/$ref", pathItems); + Assert.Contains("/Orders({id})/MultipleCustomers({ID})/$ref", pathItems); } [Fact] diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/PathItem/RefPathItemHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/PathItem/RefPathItemHandlerTests.cs index ee055a43..9907792e 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/PathItem/RefPathItemHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/PathItem/RefPathItemHandlerTests.cs @@ -57,6 +57,7 @@ public void CreatePathItemThrowsForNonNavigationPropertyPath() } [Theory] + [InlineData(true, new OperationType[] { OperationType.Delete})] [InlineData(true, new OperationType[] { OperationType.Get, OperationType.Post})] [InlineData(false, new OperationType[] { OperationType.Get, OperationType.Put, OperationType.Delete })] public void CreateNavigationPropertyRefPathItemReturnsCorrectPathItem(bool collectionNav, OperationType[] expected) @@ -73,10 +74,23 @@ public void CreateNavigationPropertyRefPathItemReturnsCorrectPathItem(bool colle (collectionNav ? c.TargetMultiplicity() == EdmMultiplicity.Many : c.TargetMultiplicity() != EdmMultiplicity.Many)); Assert.NotNull(property); - ODataPath path = new ODataPath(new ODataNavigationSourceSegment(entitySet), + ODataPath path; + if (collectionNav && expected.Contains(OperationType.Delete)) + { + // DELETE ~/entityset/{key}/collection-valued-Nav/{key}/$ref + path = new ODataPath(new ODataNavigationSourceSegment(entitySet), new ODataKeySegment(entityType), new ODataNavigationPropertySegment(property), + new ODataKeySegment(property.ToEntityType()), ODataRefSegment.Instance); + } + else + { + path = new ODataPath(new ODataNavigationSourceSegment(entitySet), + new ODataKeySegment(entityType), + new ODataNavigationPropertySegment(property), + ODataRefSegment.Instance); + } // Act var pathItem = _pathItemHandler.CreatePathItem(context, path); From 0b1a1c2628c1cfb66b6dbf74ce0454cb3374f3c4 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Mon, 2 Aug 2021 23:29:07 +0300 Subject: [PATCH 6/9] Update test files --- .../Edm/ODataPathProviderTests.cs | 2 +- .../Resources/Multiple.Schema.OpenApi.V2.json | 162 ++++++++ .../Resources/Multiple.Schema.OpenApi.V2.yaml | 117 ++++++ .../Resources/Multiple.Schema.OpenApi.json | 186 +++++++++ .../Resources/Multiple.Schema.OpenApi.yaml | 129 +++++++ .../Resources/TripService.OpenApi.V2.json | 314 +++++++++++++++ .../Resources/TripService.OpenApi.V2.yaml | 222 +++++++++++ .../Resources/TripService.OpenApi.json | 364 ++++++++++++++++++ .../Resources/TripService.OpenApi.yaml | 247 ++++++++++++ 9 files changed, 1742 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs index 436ac656..481f45cd 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs @@ -336,7 +336,7 @@ public void GetPathsWithFalseNavigabilityInNavigationRestrictionsAnnotationWorks // Assert Assert.NotNull(paths); - Assert.Equal(6, paths.Count()); + Assert.Equal(7, paths.Count()); var pathItems = paths.Select(p => p.GetPathItemName()).ToList(); Assert.DoesNotContain("/Orders({id})/SingleCustomer", pathItems); 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 77d962d6..326eeb1c 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 @@ -773,6 +773,60 @@ "x-ms-docs-operation-type": "operation" } }, + "/Documents({Id})/Revisions({Id1})/$ref": { + "delete": { + "tags": [ + "Documents.RevisionDto" + ], + "summary": "Delete ref of navigation property Revisions for Documents", + "operationId": "Documents.DeleteRefRevisions", + "parameters": [ + { + "in": "path", + "name": "Id", + "description": "key: Id of DocumentDto", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "DocumentDto" + }, + { + "in": "path", + "name": "Id1", + "description": "key: Id of RevisionDto", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "RevisionDto" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Documents({Id})/Revisions/$ref": { "get": { "tags": [ @@ -1375,6 +1429,60 @@ "x-ms-docs-operation-type": "operation" } }, + "/Libraries({Id})/Documents({Id1})/$ref": { + "delete": { + "tags": [ + "Libraries.DocumentDto" + ], + "summary": "Delete ref of navigation property Documents for Libraries", + "operationId": "Libraries.DeleteRefDocuments", + "parameters": [ + { + "in": "path", + "name": "Id", + "description": "key: Id of LibraryDto", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "LibraryDto" + }, + { + "in": "path", + "name": "Id1", + "description": "key: Id of DocumentDto", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "DocumentDto" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Libraries({Id})/Documents/$ref": { "get": { "tags": [ @@ -2560,6 +2668,60 @@ "x-ms-docs-operation-type": "operation" } }, + "/Tasks({Id})/Revisions({Id1})/$ref": { + "delete": { + "tags": [ + "Tasks.RevisionDto" + ], + "summary": "Delete ref of navigation property Revisions for Tasks", + "operationId": "Tasks.DeleteRefRevisions", + "parameters": [ + { + "in": "path", + "name": "Id", + "description": "key: Id of DocumentDto", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "DocumentDto" + }, + { + "in": "path", + "name": "Id1", + "description": "key: Id of RevisionDto", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "RevisionDto" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Tasks({Id})/Revisions/$ref": { "get": { "tags": [ 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 50be6ed0..4275c6d8 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 @@ -549,6 +549,45 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/Documents({Id})/Revisions({Id1})/$ref': + delete: + tags: + - Documents.RevisionDto + summary: Delete ref of navigation property Revisions for Documents + operationId: Documents.DeleteRefRevisions + parameters: + - in: path + name: Id + description: 'key: Id of DocumentDto' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: DocumentDto + - in: path + name: Id1 + description: 'key: Id of RevisionDto' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: RevisionDto + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/Documents({Id})/Revisions/$ref': get: tags: @@ -985,6 +1024,45 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/Libraries({Id})/Documents({Id1})/$ref': + delete: + tags: + - Libraries.DocumentDto + summary: Delete ref of navigation property Documents for Libraries + operationId: Libraries.DeleteRefDocuments + parameters: + - in: path + name: Id + description: 'key: Id of LibraryDto' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: LibraryDto + - in: path + name: Id1 + description: 'key: Id of DocumentDto' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: DocumentDto + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/Libraries({Id})/Documents/$ref': get: tags: @@ -1853,6 +1931,45 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/Tasks({Id})/Revisions({Id1})/$ref': + delete: + tags: + - Tasks.RevisionDto + summary: Delete ref of navigation property Revisions for Tasks + operationId: Tasks.DeleteRefRevisions + parameters: + - in: path + name: Id + description: 'key: Id of DocumentDto' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: DocumentDto + - in: path + name: Id1 + description: 'key: Id of RevisionDto' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: RevisionDto + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/Tasks({Id})/Revisions/$ref': get: tags: 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 40d2b6f5..383ef8e8 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 @@ -867,6 +867,68 @@ "x-ms-docs-operation-type": "operation" } }, + "/Documents({Id})/Revisions({Id1})/$ref": { + "delete": { + "tags": [ + "Documents.RevisionDto" + ], + "summary": "Delete ref of navigation property Revisions for Documents", + "operationId": "Documents.DeleteRefRevisions", + "parameters": [ + { + "name": "Id", + "in": "path", + "description": "key: Id of DocumentDto", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "DocumentDto" + }, + { + "name": "Id1", + "in": "path", + "description": "key: Id of RevisionDto", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "RevisionDto" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Documents({Id})/Revisions/$ref": { "get": { "tags": [ @@ -1537,6 +1599,68 @@ "x-ms-docs-operation-type": "operation" } }, + "/Libraries({Id})/Documents({Id1})/$ref": { + "delete": { + "tags": [ + "Libraries.DocumentDto" + ], + "summary": "Delete ref of navigation property Documents for Libraries", + "operationId": "Libraries.DeleteRefDocuments", + "parameters": [ + { + "name": "Id", + "in": "path", + "description": "key: Id of LibraryDto", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "LibraryDto" + }, + { + "name": "Id1", + "in": "path", + "description": "key: Id of DocumentDto", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "DocumentDto" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Libraries({Id})/Documents/$ref": { "get": { "tags": [ @@ -2918,6 +3042,68 @@ "x-ms-docs-operation-type": "operation" } }, + "/Tasks({Id})/Revisions({Id1})/$ref": { + "delete": { + "tags": [ + "Tasks.RevisionDto" + ], + "summary": "Delete ref of navigation property Revisions for Tasks", + "operationId": "Tasks.DeleteRefRevisions", + "parameters": [ + { + "name": "Id", + "in": "path", + "description": "key: Id of DocumentDto", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "DocumentDto" + }, + { + "name": "Id1", + "in": "path", + "description": "key: Id of RevisionDto", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "RevisionDto" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Tasks({Id})/Revisions/$ref": { "get": { "tags": [ 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 7f5a770a..7ceeab47 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 @@ -609,6 +609,49 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/Documents({Id})/Revisions({Id1})/$ref': + delete: + tags: + - Documents.RevisionDto + summary: Delete ref of navigation property Revisions for Documents + operationId: Documents.DeleteRefRevisions + parameters: + - name: Id + in: path + description: 'key: Id of DocumentDto' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: DocumentDto + - name: Id1 + in: path + description: 'key: Id of RevisionDto' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: RevisionDto + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/Documents({Id})/Revisions/$ref': get: tags: @@ -1089,6 +1132,49 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/Libraries({Id})/Documents({Id1})/$ref': + delete: + tags: + - Libraries.DocumentDto + summary: Delete ref of navigation property Documents for Libraries + operationId: Libraries.DeleteRefDocuments + parameters: + - name: Id + in: path + description: 'key: Id of LibraryDto' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: LibraryDto + - name: Id1 + in: path + description: 'key: Id of DocumentDto' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: DocumentDto + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/Libraries({Id})/Documents/$ref': get: tags: @@ -2082,6 +2168,49 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/Tasks({Id})/Revisions({Id1})/$ref': + delete: + tags: + - Tasks.RevisionDto + summary: Delete ref of navigation property Revisions for Tasks + operationId: Tasks.DeleteRefRevisions + parameters: + - name: Id + in: path + description: 'key: Id of DocumentDto' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: DocumentDto + - name: Id1 + in: path + description: 'key: Id of RevisionDto' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: RevisionDto + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/Tasks({Id})/Revisions/$ref': get: tags: 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 3f5b0f1b..71f40acd 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 @@ -960,6 +960,46 @@ "x-ms-docs-operation-type": "operation" } }, + "/Me/Friends/{UserName}/$ref": { + "delete": { + "tags": [ + "Me.Person" + ], + "summary": "Delete ref of navigation property Friends for Me", + "operationId": "Me.DeleteRefFriends", + "parameters": [ + { + "in": "path", + "name": "UserName", + "description": "key: UserName of Person", + "required": true, + "type": "string", + "x-ms-docs-key-type": "Person" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Me/Friends/$ref": { "get": { "tags": [ @@ -1719,6 +1759,60 @@ "x-ms-docs-operation-type": "operation" } }, + "/Me/Trips/{TripId}/PlanItems/{PlanItemId}/$ref": { + "delete": { + "tags": [ + "Me.Trips.PlanItem" + ], + "summary": "Delete ref of navigation property PlanItems for Me", + "operationId": "Me.Trips.DeleteRefPlanItems", + "parameters": [ + { + "in": "path", + "name": "TripId", + "description": "key: TripId of Trip", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "Trip" + }, + { + "in": "path", + "name": "PlanItemId", + "description": "key: PlanItemId of PlanItem", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "PlanItem" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Me/Trips/{TripId}/PlanItems/$ref": { "get": { "tags": [ @@ -2469,6 +2563,54 @@ "x-ms-docs-operation-type": "operation" } }, + "/NewComePeople/{UserName}/Friends/{UserName1}/$ref": { + "delete": { + "tags": [ + "NewComePeople.Person" + ], + "summary": "Delete ref of navigation property Friends for NewComePeople", + "operationId": "NewComePeople.DeleteRefFriends", + "parameters": [ + { + "in": "path", + "name": "UserName", + "description": "key: UserName of Person", + "required": true, + "type": "string", + "x-ms-docs-key-type": "Person" + }, + { + "in": "path", + "name": "UserName1", + "description": "key: UserName of Person", + "required": true, + "type": "string", + "x-ms-docs-key-type": "Person" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/NewComePeople/{UserName}/Friends/$ref": { "get": { "tags": [ @@ -3342,6 +3484,68 @@ "x-ms-docs-operation-type": "operation" } }, + "/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref": { + "delete": { + "tags": [ + "NewComePeople.Trips.PlanItem" + ], + "summary": "Delete ref of navigation property PlanItems for NewComePeople", + "operationId": "NewComePeople.Trips.DeleteRefPlanItems", + "parameters": [ + { + "in": "path", + "name": "UserName", + "description": "key: UserName of Person", + "required": true, + "type": "string", + "x-ms-docs-key-type": "Person" + }, + { + "in": "path", + "name": "TripId", + "description": "key: TripId of Trip", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "Trip" + }, + { + "in": "path", + "name": "PlanItemId", + "description": "key: PlanItemId of PlanItem", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "PlanItem" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/$ref": { "get": { "tags": [ @@ -4108,6 +4312,54 @@ "x-ms-docs-operation-type": "operation" } }, + "/People/{UserName}/Friends/{UserName1}/$ref": { + "delete": { + "tags": [ + "People.Person" + ], + "summary": "Delete ref of navigation property Friends for People", + "operationId": "People.DeleteRefFriends", + "parameters": [ + { + "in": "path", + "name": "UserName", + "description": "key: UserName of Person", + "required": true, + "type": "string", + "x-ms-docs-key-type": "Person" + }, + { + "in": "path", + "name": "UserName1", + "description": "key: UserName of Person", + "required": true, + "type": "string", + "x-ms-docs-key-type": "Person" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/People/{UserName}/Friends/$ref": { "get": { "tags": [ @@ -4981,6 +5233,68 @@ "x-ms-docs-operation-type": "operation" } }, + "/People/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref": { + "delete": { + "tags": [ + "People.Trips.PlanItem" + ], + "summary": "Delete ref of navigation property PlanItems for People", + "operationId": "People.Trips.DeleteRefPlanItems", + "parameters": [ + { + "in": "path", + "name": "UserName", + "description": "key: UserName of Person", + "required": true, + "type": "string", + "x-ms-docs-key-type": "Person" + }, + { + "in": "path", + "name": "TripId", + "description": "key: TripId of Trip", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "Trip" + }, + { + "in": "path", + "name": "PlanItemId", + "description": "key: PlanItemId of PlanItem", + "required": true, + "type": "integer", + "format": "int32", + "maximum": 2147483647, + "minimum": -2147483648, + "x-ms-docs-key-type": "PlanItem" + }, + { + "in": "header", + "name": "If-Match", + "description": "ETag", + "type": "string" + }, + { + "in": "query", + "name": "@id", + "description": "Delete Uri", + "type": "string" + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/People/{UserName}/Trips/{TripId}/PlanItems/$ref": { "get": { "tags": [ 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 7262b3ef..531ce05e 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 @@ -657,6 +657,33 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/Me/Friends/{UserName}/$ref': + delete: + tags: + - Me.Person + summary: Delete ref of navigation property Friends for Me + operationId: Me.DeleteRefFriends + parameters: + - in: path + name: UserName + description: 'key: UserName of Person' + required: true + type: string + x-ms-docs-key-type: Person + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation /Me/Friends/$ref: get: tags: @@ -1180,6 +1207,45 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/Me/Trips/{TripId}/PlanItems/{PlanItemId}/$ref': + delete: + tags: + - Me.Trips.PlanItem + summary: Delete ref of navigation property PlanItems for Me + operationId: Me.Trips.DeleteRefPlanItems + parameters: + - in: path + name: TripId + description: 'key: TripId of Trip' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: Trip + - in: path + name: PlanItemId + description: 'key: PlanItemId of PlanItem' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: PlanItem + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/Me/Trips/{TripId}/PlanItems/$ref': get: tags: @@ -1711,6 +1777,39 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/NewComePeople/{UserName}/Friends/{UserName1}/$ref': + delete: + tags: + - NewComePeople.Person + summary: Delete ref of navigation property Friends for NewComePeople + operationId: NewComePeople.DeleteRefFriends + parameters: + - in: path + name: UserName + description: 'key: UserName of Person' + required: true + type: string + x-ms-docs-key-type: Person + - in: path + name: UserName1 + description: 'key: UserName of Person' + required: true + type: string + x-ms-docs-key-type: Person + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/NewComePeople/{UserName}/Friends/$ref': get: tags: @@ -2319,6 +2418,51 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref': + delete: + tags: + - NewComePeople.Trips.PlanItem + summary: Delete ref of navigation property PlanItems for NewComePeople + operationId: NewComePeople.Trips.DeleteRefPlanItems + parameters: + - in: path + name: UserName + description: 'key: UserName of Person' + required: true + type: string + x-ms-docs-key-type: Person + - in: path + name: TripId + description: 'key: TripId of Trip' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: Trip + - in: path + name: PlanItemId + description: 'key: PlanItemId of PlanItem' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: PlanItem + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/$ref': get: tags: @@ -2862,6 +3006,39 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/People/{UserName}/Friends/{UserName1}/$ref': + delete: + tags: + - People.Person + summary: Delete ref of navigation property Friends for People + operationId: People.DeleteRefFriends + parameters: + - in: path + name: UserName + description: 'key: UserName of Person' + required: true + type: string + x-ms-docs-key-type: Person + - in: path + name: UserName1 + description: 'key: UserName of Person' + required: true + type: string + x-ms-docs-key-type: Person + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/People/{UserName}/Friends/$ref': get: tags: @@ -3470,6 +3647,51 @@ paths: default: $ref: '#/responses/error' x-ms-docs-operation-type: operation + '/People/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref': + delete: + tags: + - People.Trips.PlanItem + summary: Delete ref of navigation property PlanItems for People + operationId: People.Trips.DeleteRefPlanItems + parameters: + - in: path + name: UserName + description: 'key: UserName of Person' + required: true + type: string + x-ms-docs-key-type: Person + - in: path + name: TripId + description: 'key: TripId of Trip' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: Trip + - in: path + name: PlanItemId + description: 'key: PlanItemId of PlanItem' + required: true + type: integer + format: int32 + maximum: 2147483647 + minimum: -2147483648 + x-ms-docs-key-type: PlanItem + - in: header + name: If-Match + description: ETag + type: string + - in: query + name: '@id' + description: Delete Uri + type: string + responses: + '204': + description: Success + default: + $ref: '#/responses/error' + x-ms-docs-operation-type: operation '/People/{UserName}/Trips/{TripId}/PlanItems/$ref': get: tags: 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 b93bbcda..30639236 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json @@ -1105,6 +1105,52 @@ "x-ms-docs-operation-type": "operation" } }, + "/Me/Friends/{UserName}/$ref": { + "delete": { + "tags": [ + "Me.Person" + ], + "summary": "Delete ref of navigation property Friends for Me", + "operationId": "Me.DeleteRefFriends", + "parameters": [ + { + "name": "UserName", + "in": "path", + "description": "key: UserName of Person", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-docs-key-type": "Person" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Me/Friends/$ref": { "get": { "tags": [ @@ -1943,6 +1989,68 @@ "x-ms-docs-operation-type": "operation" } }, + "/Me/Trips/{TripId}/PlanItems/{PlanItemId}/$ref": { + "delete": { + "tags": [ + "Me.Trips.PlanItem" + ], + "summary": "Delete ref of navigation property PlanItems for Me", + "operationId": "Me.Trips.DeleteRefPlanItems", + "parameters": [ + { + "name": "TripId", + "in": "path", + "description": "key: TripId of Trip", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "Trip" + }, + { + "name": "PlanItemId", + "in": "path", + "description": "key: PlanItemId of PlanItem", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "PlanItem" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/Me/Trips/{TripId}/PlanItems/$ref": { "get": { "tags": [ @@ -2774,6 +2882,62 @@ "x-ms-docs-operation-type": "operation" } }, + "/NewComePeople/{UserName}/Friends/{UserName1}/$ref": { + "delete": { + "tags": [ + "NewComePeople.Person" + ], + "summary": "Delete ref of navigation property Friends for NewComePeople", + "operationId": "NewComePeople.DeleteRefFriends", + "parameters": [ + { + "name": "UserName", + "in": "path", + "description": "key: UserName of Person", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-docs-key-type": "Person" + }, + { + "name": "UserName1", + "in": "path", + "description": "key: UserName of Person", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-docs-key-type": "Person" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/NewComePeople/{UserName}/Friends/$ref": { "get": { "tags": [ @@ -3762,6 +3926,78 @@ "x-ms-docs-operation-type": "operation" } }, + "/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref": { + "delete": { + "tags": [ + "NewComePeople.Trips.PlanItem" + ], + "summary": "Delete ref of navigation property PlanItems for NewComePeople", + "operationId": "NewComePeople.Trips.DeleteRefPlanItems", + "parameters": [ + { + "name": "UserName", + "in": "path", + "description": "key: UserName of Person", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-docs-key-type": "Person" + }, + { + "name": "TripId", + "in": "path", + "description": "key: TripId of Trip", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "Trip" + }, + { + "name": "PlanItemId", + "in": "path", + "description": "key: PlanItemId of PlanItem", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "PlanItem" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/$ref": { "get": { "tags": [ @@ -4613,6 +4849,62 @@ "x-ms-docs-operation-type": "operation" } }, + "/People/{UserName}/Friends/{UserName1}/$ref": { + "delete": { + "tags": [ + "People.Person" + ], + "summary": "Delete ref of navigation property Friends for People", + "operationId": "People.DeleteRefFriends", + "parameters": [ + { + "name": "UserName", + "in": "path", + "description": "key: UserName of Person", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-docs-key-type": "Person" + }, + { + "name": "UserName1", + "in": "path", + "description": "key: UserName of Person", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-docs-key-type": "Person" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/People/{UserName}/Friends/$ref": { "get": { "tags": [ @@ -5601,6 +5893,78 @@ "x-ms-docs-operation-type": "operation" } }, + "/People/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref": { + "delete": { + "tags": [ + "People.Trips.PlanItem" + ], + "summary": "Delete ref of navigation property PlanItems for People", + "operationId": "People.Trips.DeleteRefPlanItems", + "parameters": [ + { + "name": "UserName", + "in": "path", + "description": "key: UserName of Person", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-docs-key-type": "Person" + }, + { + "name": "TripId", + "in": "path", + "description": "key: TripId of Trip", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "Trip" + }, + { + "name": "PlanItemId", + "in": "path", + "description": "key: PlanItemId of PlanItem", + "required": true, + "schema": { + "maximum": 2147483647, + "minimum": -2147483648, + "type": "integer", + "format": "int32" + }, + "x-ms-docs-key-type": "PlanItem" + }, + { + "name": "If-Match", + "in": "header", + "description": "ETag", + "schema": { + "type": "string" + } + }, + { + "name": "@id", + "in": "query", + "description": "Delete Uri", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "$ref": "#/components/responses/error" + } + }, + "x-ms-docs-operation-type": "operation" + } + }, "/People/{UserName}/Trips/{TripId}/PlanItems/$ref": { "get": { "tags": [ 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 2c882bdd..57c53be5 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml @@ -742,6 +742,36 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/Me/Friends/{UserName}/$ref': + delete: + tags: + - Me.Person + summary: Delete ref of navigation property Friends for Me + operationId: Me.DeleteRefFriends + parameters: + - name: UserName + in: path + description: 'key: UserName of Person' + required: true + schema: + type: string + x-ms-docs-key-type: Person + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation /Me/Friends/$ref: get: tags: @@ -1308,6 +1338,49 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/Me/Trips/{TripId}/PlanItems/{PlanItemId}/$ref': + delete: + tags: + - Me.Trips.PlanItem + summary: Delete ref of navigation property PlanItems for Me + operationId: Me.Trips.DeleteRefPlanItems + parameters: + - name: TripId + in: path + description: 'key: TripId of Trip' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: Trip + - name: PlanItemId + in: path + description: 'key: PlanItemId of PlanItem' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: PlanItem + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/Me/Trips/{TripId}/PlanItems/$ref': get: tags: @@ -1890,6 +1963,43 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/NewComePeople/{UserName}/Friends/{UserName1}/$ref': + delete: + tags: + - NewComePeople.Person + summary: Delete ref of navigation property Friends for NewComePeople + operationId: NewComePeople.DeleteRefFriends + parameters: + - name: UserName + in: path + description: 'key: UserName of Person' + required: true + schema: + type: string + x-ms-docs-key-type: Person + - name: UserName1 + in: path + description: 'key: UserName of Person' + required: true + schema: + type: string + x-ms-docs-key-type: Person + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/NewComePeople/{UserName}/Friends/$ref': get: tags: @@ -2559,6 +2669,56 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref': + delete: + tags: + - NewComePeople.Trips.PlanItem + summary: Delete ref of navigation property PlanItems for NewComePeople + operationId: NewComePeople.Trips.DeleteRefPlanItems + parameters: + - name: UserName + in: path + description: 'key: UserName of Person' + required: true + schema: + type: string + x-ms-docs-key-type: Person + - name: TripId + in: path + description: 'key: TripId of Trip' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: Trip + - name: PlanItemId + in: path + description: 'key: PlanItemId of PlanItem' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: PlanItem + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/NewComePeople/{UserName}/Trips/{TripId}/PlanItems/$ref': get: tags: @@ -3155,6 +3315,43 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/People/{UserName}/Friends/{UserName1}/$ref': + delete: + tags: + - People.Person + summary: Delete ref of navigation property Friends for People + operationId: People.DeleteRefFriends + parameters: + - name: UserName + in: path + description: 'key: UserName of Person' + required: true + schema: + type: string + x-ms-docs-key-type: Person + - name: UserName1 + in: path + description: 'key: UserName of Person' + required: true + schema: + type: string + x-ms-docs-key-type: Person + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/People/{UserName}/Friends/$ref': get: tags: @@ -3824,6 +4021,56 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/People/{UserName}/Trips/{TripId}/PlanItems/{PlanItemId}/$ref': + delete: + tags: + - People.Trips.PlanItem + summary: Delete ref of navigation property PlanItems for People + operationId: People.Trips.DeleteRefPlanItems + parameters: + - name: UserName + in: path + description: 'key: UserName of Person' + required: true + schema: + type: string + x-ms-docs-key-type: Person + - name: TripId + in: path + description: 'key: TripId of Trip' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: Trip + - name: PlanItemId + in: path + description: 'key: PlanItemId of PlanItem' + required: true + schema: + maximum: 2147483647 + minimum: -2147483648 + type: integer + format: int32 + x-ms-docs-key-type: PlanItem + - name: If-Match + in: header + description: ETag + schema: + type: string + - name: '@id' + in: query + description: Delete Uri + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/People/{UserName}/Trips/{TripId}/PlanItems/$ref': get: tags: From bfaa4e3cf91535c38cc28a427860d6015bfb2cc6 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Wed, 18 Aug 2021 16:03:05 +0300 Subject: [PATCH 7/9] Minor update to test commit signing --- .../Edm/ODataPathProviderTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs index 481f45cd..9fdb9dd7 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs @@ -1,7 +1,7 @@ -// ------------------------------------------------------------ +// ------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. -// ------------------------------------------------------------ +// ------------------------------------------------------------- using System; using System.Collections.Generic; From eb55b4daf88b5922556677b028c90fab321a4bff Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Wed, 18 Aug 2021 16:16:04 +0300 Subject: [PATCH 8/9] Another minor update to trigger commit signing --- .../Edm/ODataPathProviderTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs index 9fdb9dd7..9f160a95 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs @@ -1,7 +1,7 @@ -// ------------------------------------------------------------- +// -------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. -// ------------------------------------------------------------- +// -------------------------------------------------------------- using System; using System.Collections.Generic; From 5952d2a53a1d811a960d6d6e2fee709c504b2d49 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Mon, 23 Aug 2021 15:54:31 +0300 Subject: [PATCH 9/9] Update tests appropriately --- .../Edm/ODataPathProviderTests.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs index 11fc46e7..2494b793 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs @@ -478,14 +478,14 @@ public void GetPathsWithStreamPropertyAndWithEntityHasStreamWorks(bool hasStream { if (hasStream) { - Assert.Equal(12, paths.Count()); + Assert.Equal(13, paths.Count()); Assert.Contains(TodosValuePath, paths.Select(p => p.GetPathItemName())); Assert.Contains(TodosLogoPath, paths.Select(p => p.GetPathItemName())); Assert.DoesNotContain(TodosContentPath, paths.Select(p => p.GetPathItemName())); } else { - Assert.Equal(11, paths.Count()); + Assert.Equal(12, paths.Count()); Assert.Contains(TodosLogoPath, paths.Select(p => p.GetPathItemName())); Assert.DoesNotContain(TodosContentPath, paths.Select(p => p.GetPathItemName())); Assert.DoesNotContain(TodosValuePath, paths.Select(p => p.GetPathItemName())); @@ -493,7 +493,7 @@ public void GetPathsWithStreamPropertyAndWithEntityHasStreamWorks(bool hasStream } else if (streamPropName.Equals("content")) { - Assert.Equal(11, paths.Count()); + Assert.Equal(12, paths.Count()); Assert.Contains(TodosContentPath, paths.Select(p => p.GetPathItemName())); Assert.DoesNotContain(TodosLogoPath, paths.Select(p => p.GetPathItemName())); Assert.DoesNotContain(TodosValuePath, paths.Select(p => p.GetPathItemName())); @@ -610,6 +610,12 @@ private static IEdmModel GetEdmModel(bool hasStream, string streamPropName) + + + + + +