Skip to content

Commit

Permalink
Account for OData type cast segments present in NavigationProperty pa…
Browse files Browse the repository at this point in the history
…th kind
  • Loading branch information
irvinesunday committed Nov 2, 2023
1 parent 967f3ef commit 40e71ed
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Microsoft.OpenApi.OData.Reader/Common/EdmModelHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ internal static IList<string> RetrieveNavigationPropertyPathsOperationIdSegments
{
if (segment == navPropSegments.Last())
{
// If there exists an OData type cast segment present in the path,
// this segement identifier needs to be added to the operation id
ODataTypeCastSegment typeCastSegment = path.Segments.OfType<ODataTypeCastSegment>().LastOrDefault();
if (typeCastSegment != null && path.Kind == ODataPathKind.NavigationProperty)
{
IEdmSchemaElement schemaElement = typeCastSegment.StructuredType as IEdmSchemaElement;
items.Add("As" + Utils.UpperFirstChar(schemaElement.Name));
}

items.Add(segment.NavigationProperty.Name);
break;
}
Expand Down

0 comments on commit 40e71ed

Please sign in to comment.