Skip to content

Commit 2af6dd0

Browse files
authored
Apply suggestions from code review
1 parent f222ad6 commit 2af6dd0

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/Microsoft.OpenApi.OData.Reader/Common/EdmModelHelper.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,10 @@ internal static string StripOrAliasNamespacePrefix(IEdmSchemaElement element, Op
365365
namespaceAlias = model.GetNamespaceAlias(namespaceName);
366366
}
367367

368-
if (element is IEdmStructuredType)
369-
{
370-
if (settings.EnableAliasForTypeCastSegments && !string.IsNullOrEmpty(namespaceAlias))
371-
{
372-
// Alias type cast segment name
373-
segmentName = namespaceAlias.TrimEnd('.') + "." + element.Name;
374-
}
368+
if (element is IEdmStructuredType && settings.EnableAliasForTypeCastSegments && !string.IsNullOrEmpty(namespaceAlias))
369+
{
370+
// Alias type cast segment name
371+
segmentName = namespaceAlias.TrimEnd('.') + "." + element.Name;
375372
}
376373

377374
if (element is IEdmOperation)

src/Microsoft.OpenApi.OData.Reader/Edm/ODataTypeCastSegment.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ public override string GetPathItemName(OpenApiConvertSettings settings, HashSet<
5151
{
5252
Utils.CheckArgumentNull(settings, nameof(settings));
5353

54-
IEdmSchemaElement element = StructuredType as IEdmSchemaElement;
5554

56-
return element != null && _model != null
55+
return StructuredType is IEdmSchemaElement element && _model != null
5756
? EdmModelHelper.StripOrAliasNamespacePrefix(element, settings, _model)
58-
: (element?.FullName());
57+
: (StructuredType.FullName());
5958
}
6059
}

0 commit comments

Comments
 (0)