Skip to content

Commit

Permalink
Reflection of #642
Browse files Browse the repository at this point in the history
  • Loading branch information
Microsoft Graph DevX Tooling authored and Microsoft Graph DevX Tooling committed Jan 20, 2025
1 parent 547c7c0 commit 740d254
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Further fix for generating unique operation ids for paths with composable overloaded functions where all functions in path are overloaded #594
- Further fix for generating unique operation ids for navigation property paths with composable overloaded functions #596
- Updates PUT operation id prefix from Update to Set #600
- Adds action/function suffix to tag names for actions/functions operations #641
</PackageReleaseNotes>
<AssemblyName>Microsoft.OpenApi.OData.Reader</AssemblyName>
<AssemblyOriginatorKeyFile>..\..\tool\Microsoft.OpenApi.OData.snk</AssemblyOriginatorKeyFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,17 @@ private void GenerateTagName(out string tagName, int skip = 1)
skip += 1;
GenerateTagName(out tagName, skip);
break;
// If the operation is a function or action, append the word "Function" or "Action" to the tag name
case ODataOperationSegment operationSegment:
default:
tagName = NavigationSource.Name + "." + NavigationSource.EntityType.Name;
if(operationSegment.Operation.IsAction())
if (EdmOperation.IsAction())
{
tagName += ".Actions";
}

if(operationSegment.Operation.IsFunction())
else if (EdmOperation.IsFunction())
{
tagName += ".Functions";
}
break;
default:
tagName = NavigationSource.Name + "." + NavigationSource.EntityType.Name;
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void CreateOperationForEdmActionReturnsCorrectOperation()
Assert.Equal("Details of the shared trip.", operation.Description);
Assert.NotNull(operation.Tags);
var tag = Assert.Single(operation.Tags);
Assert.Equal("People.Person", tag.Name);
Assert.Equal("People.Person.Actions", tag.Name);

Assert.NotNull(operation.Parameters);
Assert.Single(operation.Parameters);
Expand Down Expand Up @@ -79,7 +79,7 @@ public void CreateOperationForEdmActionReturnsCorrectOperationHierarchicalClass(
Assert.Equal($"Invoke action {actionName}", operation.Summary);
Assert.NotNull(operation.Tags);
var tag = Assert.Single(operation.Tags);
Assert.Equal($"{entitySetName}.AccountApiModel", tag.Name);
Assert.Equal($"{entitySetName}.AccountApiModel.Actions", tag.Name);

Assert.NotNull(operation.Parameters);
Assert.Single(operation.Parameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void CreateOperationForEdmFunctionReturnsCorrectOperation(bool useHTTPSta
Assert.Equal("Invoke function GetFavoriteAirline", operation.Summary);
Assert.NotNull(operation.Tags);
var tag = Assert.Single(operation.Tags);
Assert.Equal("People.Person", tag.Name);
Assert.Equal("People.Person.Functions", tag.Name);

Assert.NotNull(operation.Parameters);
Assert.Single(operation.Parameters);
Expand Down Expand Up @@ -138,7 +138,7 @@ public void CreateOperationForEdmFunctionReturnsCorrectOperationHierarchicalClas
Assert.Equal("Collection of contract attachments.", operation.Description);
Assert.NotNull(operation.Tags);
var tag = Assert.Single(operation.Tags);
Assert.Equal($"{entitySetName}.AccountApiModel", tag.Name);
Assert.Equal($"{entitySetName}.AccountApiModel.Functions", tag.Name);

Assert.NotNull(operation.Parameters);
Assert.Equal(6, operation.Parameters.Count); // id, top, skip, count, search, filter
Expand Down Expand Up @@ -378,10 +378,10 @@ public void CreateOperationForComposableOverloadEdmFunctionReturnsCorrectOperati

if (enableOperationId)
{
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-c53d", operation1.OperationId);
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-4d93", operation2.OperationId);
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-a2b2", operation3.OperationId);
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-7bea", operation4.OperationId);
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-6b6d", operation1.OperationId);
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-2636", operation2.OperationId);
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-6b6d", operation3.OperationId);
Assert.Equal("Customers.Customer.MyFunction1.MyFunction2-2636", operation4.OperationId);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
"/Documents({Id})/Default.Upload": {
"post": {
"tags": [
"Documents.DocumentDto"
"Documents.DocumentDto.Actions"
],
"summary": "Invoke action Upload",
"operationId": "Documents.DocumentDto.Upload",
Expand Down Expand Up @@ -3519,7 +3519,7 @@
"/Tasks({Id})/Default.Upload": {
"post": {
"tags": [
"Tasks.DocumentDto"
"Tasks.DocumentDto.Actions"
],
"summary": "Invoke action Upload",
"operationId": "Tasks.DocumentDto.Upload",
Expand Down Expand Up @@ -6275,6 +6275,10 @@
"name": "Documents.DocumentDto",
"x-ms-docs-toc-type": "page"
},
{
"name": "Documents.DocumentDto.Actions",
"x-ms-docs-toc-type": "container"
},
{
"name": "Documents.RevisionDto",
"x-ms-docs-toc-type": "page"
Expand Down Expand Up @@ -6315,6 +6319,10 @@
"name": "Tasks.DocumentDto",
"x-ms-docs-toc-type": "page"
},
{
"name": "Tasks.DocumentDto.Actions",
"x-ms-docs-toc-type": "container"
},
{
"name": "Tasks.RevisionDto",
"x-ms-docs-toc-type": "page"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ paths:
'/Documents({Id})/Default.Upload':
post:
tags:
- Documents.DocumentDto
- Documents.DocumentDto.Actions
summary: Invoke action Upload
operationId: Documents.DocumentDto.Upload
parameters:
Expand Down Expand Up @@ -2495,7 +2495,7 @@ paths:
'/Tasks({Id})/Default.Upload':
post:
tags:
- Tasks.DocumentDto
- Tasks.DocumentDto.Actions
summary: Invoke action Upload
operationId: Tasks.DocumentDto.Upload
parameters:
Expand Down Expand Up @@ -4545,6 +4545,8 @@ tags:
x-ms-docs-toc-type: page
- name: Documents.DocumentDto
x-ms-docs-toc-type: page
- name: Documents.DocumentDto.Actions
x-ms-docs-toc-type: container
- name: Documents.RevisionDto
x-ms-docs-toc-type: page
- name: Documents.DocumentTagRelDto
Expand All @@ -4565,6 +4567,8 @@ tags:
x-ms-docs-toc-type: page
- name: Tasks.DocumentDto
x-ms-docs-toc-type: page
- name: Tasks.DocumentDto.Actions
x-ms-docs-toc-type: container
- name: Tasks.RevisionDto
x-ms-docs-toc-type: page
- name: Tasks.DocumentTagRelDto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@
"description": "Provides operations to call the Upload method.",
"post": {
"tags": [
"Documents.DocumentDto"
"Documents.DocumentDto.Actions"
],
"summary": "Invoke action Upload",
"operationId": "Documents.DocumentDto.Upload",
Expand Down Expand Up @@ -3940,7 +3940,7 @@
"description": "Provides operations to call the Upload method.",
"post": {
"tags": [
"Tasks.DocumentDto"
"Tasks.DocumentDto.Actions"
],
"summary": "Invoke action Upload",
"operationId": "Tasks.DocumentDto.Upload",
Expand Down Expand Up @@ -7481,6 +7481,10 @@
"name": "Documents.DocumentDto",
"x-ms-docs-toc-type": "page"
},
{
"name": "Documents.DocumentDto.Actions",
"x-ms-docs-toc-type": "container"
},
{
"name": "Documents.RevisionDto",
"x-ms-docs-toc-type": "page"
Expand Down Expand Up @@ -7521,6 +7525,10 @@
"name": "Tasks.DocumentDto",
"x-ms-docs-toc-type": "page"
},
{
"name": "Tasks.DocumentDto.Actions",
"x-ms-docs-toc-type": "container"
},
{
"name": "Tasks.RevisionDto",
"x-ms-docs-toc-type": "page"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ paths:
description: Provides operations to call the Upload method.
post:
tags:
- Documents.DocumentDto
- Documents.DocumentDto.Actions
summary: Invoke action Upload
operationId: Documents.DocumentDto.Upload
parameters:
Expand Down Expand Up @@ -2771,7 +2771,7 @@ paths:
description: Provides operations to call the Upload method.
post:
tags:
- Tasks.DocumentDto
- Tasks.DocumentDto.Actions
summary: Invoke action Upload
operationId: Tasks.DocumentDto.Upload
parameters:
Expand Down Expand Up @@ -5384,6 +5384,8 @@ tags:
x-ms-docs-toc-type: page
- name: Documents.DocumentDto
x-ms-docs-toc-type: page
- name: Documents.DocumentDto.Actions
x-ms-docs-toc-type: container
- name: Documents.RevisionDto
x-ms-docs-toc-type: page
- name: Documents.DocumentTagRelDto
Expand All @@ -5404,6 +5406,8 @@ tags:
x-ms-docs-toc-type: page
- name: Tasks.DocumentDto
x-ms-docs-toc-type: page
- name: Tasks.DocumentDto.Actions
x-ms-docs-toc-type: container
- name: Tasks.RevisionDto
x-ms-docs-toc-type: page
- name: Tasks.DocumentTagRelDto
Expand Down
Loading

0 comments on commit 740d254

Please sign in to comment.