From 611067f2d3993702e5c0e9c4b8adec68c598a26e Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Thu, 26 Aug 2021 22:25:55 +0300 Subject: [PATCH] [Enhancement] Creates DELETE operation for collection-valued nav. props $ref paths (#112) * Generate collection nav. prop. entity paths for non-contained nav. props * Revert previous changes * Paths with DELETE operations for collection-valued nav. prop. $ref paths * Don't create extra path for OData Key segment when creating DELETE for $ref * Update tests * Update test files * Minor update to test commit signing * Another minor update to trigger commit signing * Update tests appropriately --- .../Edm/ODataPathProvider.cs | 52 ++- .../PathItem/RefPathItemHandler.cs | 69 ++-- .../Edm/ODataPathProviderTests.cs | 25 +- .../PathItem/RefPathItemHandlerTests.cs | 16 +- .../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 ++++++++++++ 12 files changed, 1851 insertions(+), 52 deletions(-) diff --git a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs index 75bb41f..87b1c77 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs @@ -271,37 +271,38 @@ namespace Microsoft.OpenApi.OData.Edm // 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.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) + { + // Collection-valued: DELETE ~/entityset/{key}/collection-valued-Nav/{key}/$ref + currentPath.Push(new ODataKeySegment(navEntityType)); + 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); - } } - // Get possible navigation property stream paths + // Get possible stream paths for the navigation entity type RetrieveMediaEntityStreamPaths(navEntityType, currentPath); if (shouldExpand) @@ -315,11 +316,11 @@ namespace Microsoft.OpenApi.OData.Edm } } } + } - if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) - { - currentPath.Pop(); - } + if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + currentPath.Pop(); } } currentPath.Pop(); @@ -349,6 +350,17 @@ namespace Microsoft.OpenApi.OData.Edm 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); + } + /// /// Retrieve all bounding . /// diff --git a/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs b/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs index 60a18bf..515de85 100644 --- a/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs @@ -68,37 +68,62 @@ namespace Microsoft.OpenApi.OData.PathItem // 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" + // Create the ref + if (NavigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + { + ODataSegment penultimateSegment = Path.Segments.Reverse().Skip(1).First(); + if (penultimateSegment is ODataKeySegment) + { + // Collection-valued: DELETE ~/entityset/{key}/collection-valued-Nav/{key}/$ref + AddDeleteOperation(item, restriction); + } + else + { + AddReadOperation(item, restriction); + AddInsertOperation(item, restriction); + } + } + else + { + AddReadOperation(item, restriction); + AddUpdateOperation(item, restriction); + AddDeleteOperation(item, restriction); + } + } + + 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); } + } - // Create the ref - if (NavigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) + private void AddInsertOperation(OpenApiPathItem item, NavigationPropertyRestriction restriction) + { + InsertRestrictionsType insert = restriction?.InsertRestrictions; + if (insert == null || insert.IsInsertable) { - InsertRestrictionsType insert = restriction?.InsertRestrictions; - if (insert == null || insert.IsInsertable) - { - AddOperation(item, OperationType.Post); - } + AddOperation(item, OperationType.Post); } - else - { - UpdateRestrictionsType update = restriction?.UpdateRestrictions; - if (update == null || update.IsUpdatable) - { - AddOperation(item, OperationType.Put); - } + } - // delete the link - DeleteRestrictionsType delete = restriction?.DeleteRestrictions; - if (delete == null || delete.IsDeletable) - { - AddOperation(item, OperationType.Delete); - } + private void AddUpdateOperation(OpenApiPathItem item, NavigationPropertyRestriction restriction) + { + UpdateRestrictionsType update = restriction?.UpdateRestrictions; + if (update == null || update.IsUpdatable) + { + AddOperation(item, OperationType.Put); } } diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Edm/ODataPathProviderTests.cs index 81307bb..2494b79 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; @@ -48,7 +48,7 @@ namespace Microsoft.OpenApi.OData.Edm.Tests // Assert Assert.NotNull(paths); - Assert.Equal(17313, paths.Count()); + Assert.Equal(17401, paths.Count()); } [Fact] @@ -67,7 +67,7 @@ namespace Microsoft.OpenApi.OData.Edm.Tests // Assert Assert.NotNull(paths); - Assert.Equal(13642, paths.Count()); + Assert.Equal(13730, paths.Count()); } [Fact] @@ -336,7 +336,7 @@ namespace Microsoft.OpenApi.OData.Edm.Tests // 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); @@ -409,13 +409,14 @@ namespace Microsoft.OpenApi.OData.Edm.Tests // 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] @@ -477,14 +478,14 @@ namespace Microsoft.OpenApi.OData.Edm.Tests { 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())); @@ -492,7 +493,7 @@ namespace Microsoft.OpenApi.OData.Edm.Tests } 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())); @@ -609,6 +610,12 @@ namespace Microsoft.OpenApi.OData.Edm.Tests + + + + + + diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/PathItem/RefPathItemHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/PathItem/RefPathItemHandlerTests.cs index ee055a4..9907792 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 @@ namespace Microsoft.OpenApi.OData.PathItem.Tests } [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 @@ namespace Microsoft.OpenApi.OData.PathItem.Tests (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); 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 77d962d..326eeb1 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 50be6ed..4275c6d 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 40d2b6f..383ef8e 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 7f5a770..7ceeab4 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 3f5b0f1..71f40ac 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 7262b3e..531ce05 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 b93bbcd..3063923 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 2c882bd..57c53be 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: