@@ -13,49 +13,26 @@ namespace Microsoft.OpenApi.Models
13
13
/// <summary>
14
14
/// Path Item Object: to describe the operations available on a single path.
15
15
/// </summary>
16
- public class OpenApiPathItem : IOpenApiExtensible , IOpenApiReferenceable
16
+ public class OpenApiPathItem : IOpenApiExtensible , IOpenApiReferenceable , IOpenApiPathItem
17
17
{
18
- /// <summary>
19
- /// An optional, string summary, intended to apply to all operations in this path.
20
- /// </summary>
21
- public virtual string Summary { get ; set ; }
18
+ /// <inheritdoc/>
19
+ public string Summary { get ; set ; }
22
20
23
- /// <summary>
24
- /// An optional, string description, intended to apply to all operations in this path.
25
- /// </summary>
26
- public virtual string Description { get ; set ; }
21
+ /// <inheritdoc/>
22
+ public string Description { get ; set ; }
27
23
28
- /// <summary>
29
- /// Gets the definition of operations on this path.
30
- /// </summary>
31
- public virtual IDictionary < OperationType , OpenApiOperation > Operations { get ; set ; }
24
+ /// <inheritdoc/>
25
+ public IDictionary < OperationType , OpenApiOperation > Operations { get ; set ; }
32
26
= new Dictionary < OperationType , OpenApiOperation > ( ) ;
33
27
34
- /// <summary>
35
- /// An alternative server array to service all operations in this path.
36
- /// </summary>
37
- public virtual IList < OpenApiServer > Servers { get ; set ; } = new List < OpenApiServer > ( ) ;
38
-
39
- /// <summary>
40
- /// A list of parameters that are applicable for all the operations described under this path.
41
- /// These parameters can be overridden at the operation level, but cannot be removed there.
42
- /// </summary>
43
- public virtual IList < IOpenApiParameter > Parameters { get ; set ; } = new List < IOpenApiParameter > ( ) ;
28
+ /// <inheritdoc/>
29
+ public IList < OpenApiServer > Servers { get ; set ; } = [ ] ;
44
30
45
- /// <summary>
46
- /// This object MAY be extended with Specification Extensions.
47
- /// </summary>
48
- public virtual IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
31
+ /// <inheritdoc/>
32
+ public IList < IOpenApiParameter > Parameters { get ; set ; } = [ ] ;
49
33
50
- /// <summary>
51
- /// Indicates if object is populated with data or is just a reference to the data
52
- /// </summary>
53
- public bool UnresolvedReference { get ; set ; }
54
-
55
- /// <summary>
56
- /// Reference object.
57
- /// </summary>
58
- public OpenApiReference Reference { get ; set ; }
34
+ /// <inheritdoc/>
35
+ public IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
59
36
60
37
/// <summary>
61
38
/// Add one operation into this path item.
@@ -75,30 +52,29 @@ public OpenApiPathItem() { }
75
52
/// <summary>
76
53
/// Initializes a clone of an <see cref="OpenApiPathItem"/> object
77
54
/// </summary>
78
- public OpenApiPathItem ( OpenApiPathItem pathItem )
55
+ public OpenApiPathItem ( IOpenApiPathItem pathItem )
79
56
{
57
+ Utils . CheckArgumentNull ( pathItem ) ;
80
58
Summary = pathItem ? . Summary ?? Summary ;
81
59
Description = pathItem ? . Description ?? Description ;
82
60
Operations = pathItem ? . Operations != null ? new Dictionary < OperationType , OpenApiOperation > ( pathItem . Operations ) : null ;
83
61
Servers = pathItem ? . Servers != null ? new List < OpenApiServer > ( pathItem . Servers ) : null ;
84
62
Parameters = pathItem ? . Parameters != null ? new List < IOpenApiParameter > ( pathItem . Parameters ) : null ;
85
63
Extensions = pathItem ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( pathItem . Extensions ) : null ;
86
- UnresolvedReference = pathItem ? . UnresolvedReference ?? UnresolvedReference ;
87
- Reference = pathItem ? . Reference != null ? new ( pathItem ? . Reference ) : null ;
88
64
}
89
65
90
66
/// <summary>
91
67
/// Serialize <see cref="OpenApiPathItem"/> to Open Api v3.1
92
68
/// </summary>
93
- public virtual void SerializeAsV31 ( IOpenApiWriter writer )
69
+ public void SerializeAsV31 ( IOpenApiWriter writer )
94
70
{
95
71
SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_1 , ( writer , element ) => element . SerializeAsV31 ( writer ) ) ;
96
72
}
97
73
98
74
/// <summary>
99
75
/// Serialize <see cref="OpenApiPathItem"/> to Open Api v3.0
100
76
/// </summary>
101
- public virtual void SerializeAsV3 ( IOpenApiWriter writer )
77
+ public void SerializeAsV3 ( IOpenApiWriter writer )
102
78
{
103
79
SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
104
80
}
0 commit comments