@@ -20,7 +20,7 @@ namespace Microsoft.OpenApi.OData.Edm
2020 public class ODataPath : IEnumerable < ODataSegment > , IComparable < ODataPath >
2121 {
2222 private ODataPathKind ? _pathKind ;
23- private string _defaultPathItemName ;
23+ private string ? _defaultPathItemName ;
2424
2525 /// <summary>
2626 /// Initializes a new instance of <see cref="ODataPath"/> class.
@@ -54,7 +54,7 @@ public ODataPath(params ODataSegment[] segments)
5454 /// Gets/Sets the path template for this path.
5555 /// If it is set, it will be used to generate the path item.
5656 /// </summary>
57- public string PathTemplate { get ; set ; }
57+ public string ? PathTemplate { get ; set ; }
5858
5959 /// <summary>
6060 /// Gets the segments.
@@ -80,12 +80,12 @@ public virtual ODataPathKind Kind
8080 /// <summary>
8181 /// Gets the first segment in the path. Returns null if the path is empty.
8282 /// </summary>
83- public ODataSegment FirstSegment => Segments . Count == 0 ? null : Segments [ 0 ] ;
83+ public ODataSegment ? FirstSegment => Segments is null || Segments . Count == 0 ? null : Segments [ 0 ] ;
8484
8585 /// <summary>
8686 /// Get the last segment in the path. Returns null if the path is empty.
8787 /// </summary>
88- public ODataSegment LastSegment => Segments . Count == 0 ? null : this . Segments [ Segments . Count - 1 ] ;
88+ public ODataSegment ? LastSegment => Segments is null || Segments . Count == 0 ? null : this . Segments [ Segments . Count - 1 ] ;
8989
9090 /// <summary>
9191 /// Get the number of segments in this path.
@@ -365,7 +365,7 @@ private ODataPathKind CalcPathType()
365365 /// </summary>
366366 /// <param name="settings">The settings.</param>
367367 ///<returns>The suffix.</returns>
368- public string GetPathHash ( OpenApiConvertSettings settings ) =>
369- LastSegment . GetPathHash ( settings , this ) ;
368+ public string ? GetPathHash ( OpenApiConvertSettings settings ) =>
369+ LastSegment ? . GetPathHash ( settings , this ) ;
370370 }
371371}
0 commit comments