Skip to content

Commit e3c680b

Browse files
committed
Disambiguate put and patch operation ids
1 parent 97ecdff commit e3c680b

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyUpdateOperationHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ protected override void SetBasicInfo(OpenApiOperation operation)
3939

4040
// OperationId
4141
if (Context.Settings.EnableOperationId)
42-
{
43-
operation.OperationId = EdmModelHelper.GenerateComplexPropertyPathOperationId(Path, Context, "Update");
42+
{
43+
string prefix = OperationType == OperationType.Patch ? "Update" : "Set";
44+
operation.OperationId = EdmModelHelper.GenerateComplexPropertyPathOperationId(Path, Context, prefix);
4445
}
4546
}
4647

src/Microsoft.OpenApi.OData.Reader/Operation/EntityUpdateOperationHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ protected override void SetBasicInfo(OpenApiOperation operation)
5050
if (Context.Settings.EnableOperationId)
5151
{
5252
string typeName = entityType.Name;
53-
string operationName = $"Update{ Utils.UpperFirstChar(typeName)}";
53+
string prefix = OperationType == OperationType.Patch ? "Update" : "Set";
54+
string operationName = $"{prefix}{ Utils.UpperFirstChar(typeName)}";
5455
if (keySegment.IsAlternateKey)
5556
{
5657
string alternateKeyName = string.Join("", keySegment.Identifier.Split(',').Select(static x => Utils.UpperFirstChar(x)));

src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyUpdateOperationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4141
// OperationId
4242
if (Context.Settings.EnableOperationId)
4343
{
44-
string prefix = "Update";
44+
string prefix = OperationType == OperationType.Patch ? "Update" : "Set";
4545
operation.OperationId = GetOperationId(prefix);
4646
}
4747

0 commit comments

Comments
 (0)