Skip to content

Commit d73da48

Browse files
committed
- code linting
Signed-off-by: Vincent Biret <[email protected]>
1 parent f5d985a commit d73da48

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/Microsoft.OpenApi.OData.Reader/PathItem/NavigationPropertyPathItemHandler.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using Microsoft.OpenApi.Any;
1515
using Microsoft.OData.Edm.Vocabularies;
1616
using Microsoft.OpenApi.OData.Vocabulary.Capabilities;
17-
using System.Drawing;
1817

1918
namespace Microsoft.OpenApi.OData.PathItem
2019
{
@@ -46,8 +45,8 @@ internal class NavigationPropertyPathItemHandler : PathItemHandler
4645
/// </summary>
4746
protected bool LastSegmentIsRefSegment { get; private set; }
4847

49-
/// <inheritdoc/>
50-
protected override void SetOperations(OpenApiPathItem item)
48+
/// <inheritdoc/>
49+
protected override void SetOperations(OpenApiPathItem item)
5150
{
5251
IEdmEntitySet entitySet = NavigationSource as IEdmEntitySet;
5352
IEdmVocabularyAnnotatable target = entitySet;
@@ -79,7 +78,7 @@ protected override void SetOperations(OpenApiPathItem item)
7978
}
8079
}
8180

82-
// contaiment: Get / (Post - Collection | Patch - Single)
81+
// containment: Get / (Post - Collection | Patch - Single)
8382
// non-containment: Get
8483
AddGetOperation(item, restriction);
8584

@@ -216,18 +215,17 @@ protected override void SetExtensions(OpenApiPathItem item)
216215
continue;
217216
}
218217

219-
ODataNavigationSourceSegment navigationSourceSegment = path.FirstSegment as ODataNavigationSourceSegment;
220-
if (NavigationSource != navigationSourceSegment.NavigationSource)
218+
if (path.FirstSegment is ODataNavigationSourceSegment navigationSourceSegment &&
219+
NavigationSource != navigationSourceSegment.NavigationSource)
221220
{
222221
continue;
223222
}
224223

225-
ODataNavigationPropertySegment npSegment = path.LastSegment as ODataNavigationPropertySegment;
226-
if (npSegment == null)
227-
{
228-
npSegment = path.Segments[path.Count - 2] as ODataNavigationPropertySegment;
229-
}
230-
if (NavigationProperty != npSegment.NavigationProperty)
224+
if (path.LastSegment is not ODataNavigationPropertySegment npSegment)
225+
{
226+
npSegment = path.Segments[path.Count - 2] as ODataNavigationPropertySegment;
227+
}
228+
if (NavigationProperty != npSegment.NavigationProperty)
231229
{
232230
continue;
233231
}
@@ -237,7 +235,7 @@ protected override void SetExtensions(OpenApiPathItem item)
237235

238236
if (samePaths.Any())
239237
{
240-
OpenApiArray array = new OpenApiArray();
238+
OpenApiArray array = new();
241239
OpenApiConvertSettings settings = Context.Settings.Clone();
242240
settings.EnableKeyAsSegment = Context.KeyAsSegment;
243241
foreach (var p in samePaths)

0 commit comments

Comments
 (0)