@@ -81,6 +81,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
8181 // duplicates in entity vs entityset functions/actions
8282
8383 List < string > identifiers = new ( ) ;
84+ string pathHash = string . Empty ;
8485 foreach ( ODataSegment segment in Path . Segments )
8586 {
8687 if ( segment is ODataKeySegment keySegment )
@@ -101,6 +102,16 @@ protected override void SetBasicInfo(OpenApiOperation operation)
101102 identifiers . Add ( keySegment . Identifier ) ;
102103 }
103104 }
105+ else if ( segment is ODataOperationSegment opSegment )
106+ {
107+ if ( opSegment . Operation is IEdmFunction function && Context . Model . IsOperationOverload ( function ) )
108+ {
109+ // Hash the segment to avoid duplicate operationIds
110+ pathHash = segment . GetPathHash ( Context . Settings ) ;
111+ }
112+
113+ identifiers . Add ( segment . Identifier ) ;
114+ }
104115 else
105116 {
106117 identifiers . Add ( segment . Identifier ) ;
@@ -109,21 +120,13 @@ protected override void SetBasicInfo(OpenApiOperation operation)
109120
110121 string operationId = string . Join ( "." , identifiers ) ;
111122
112- if ( EdmOperation . IsAction ( ) )
123+ if ( ! string . IsNullOrEmpty ( pathHash ) )
113124 {
114- operation . OperationId = operationId ;
125+ operation . OperationId = operationId + "-" + pathHash ;
115126 }
116127 else
117128 {
118- if ( Path . LastSegment is ODataOperationSegment operationSegment &&
119- Context . Model . IsOperationOverload ( operationSegment . Operation ) )
120- {
121- operation . OperationId = operationId + "-" + Path . LastSegment . GetPathHash ( Context . Settings ) ;
122- }
123- else
124- {
125- operation . OperationId = operationId ;
126- }
129+ operation . OperationId = operationId ;
127130 }
128131 }
129132
0 commit comments