@@ -16,84 +16,43 @@ namespace Microsoft.OpenApi.Models
1616 /// Header Object.
1717 /// The Header Object follows the structure of the Parameter Object.
1818 /// </summary>
19- public class OpenApiHeader : IOpenApiReferenceable , IOpenApiExtensible
19+ public class OpenApiHeader : IOpenApiHeader , IOpenApiReferenceable , IOpenApiExtensible
2020 {
21- private OpenApiSchema _schema ;
21+ /// <inheritdoc/>
22+ public string Description { get ; set ; }
2223
23- /// <summary>
24- /// Indicates if object is populated with data or is just a reference to the data
25- /// </summary>
26- public virtual bool UnresolvedReference { get ; set ; }
27-
28- /// <summary>
29- /// Reference pointer.
30- /// </summary>
31- public OpenApiReference Reference { get ; set ; }
32-
33- /// <summary>
34- /// A brief description of the header.
35- /// </summary>
36- public virtual string Description { get ; set ; }
24+ /// <inheritdoc/>
25+ public bool Required { get ; set ; }
3726
38- /// <summary>
39- /// Determines whether this header is mandatory.
40- /// </summary>
41- public virtual bool Required { get ; set ; }
42-
43- /// <summary>
44- /// Specifies that a header is deprecated and SHOULD be transitioned out of usage.
45- /// </summary>
46- public virtual bool Deprecated { get ; set ; }
27+ /// <inheritdoc/>
28+ public bool Deprecated { get ; set ; }
4729
48- /// <summary>
49- /// Sets the ability to pass empty-valued headers.
50- /// </summary>
51- public virtual bool AllowEmptyValue { get ; set ; }
30+ /// <inheritdoc/>
31+ public bool AllowEmptyValue { get ; set ; }
5232
53- /// <summary>
54- /// Describes how the header value will be serialized depending on the type of the header value.
55- /// </summary>
56- public virtual ParameterStyle ? Style { get ; set ; }
33+ /// <inheritdoc/>
34+ public ParameterStyle ? Style { get ; set ; }
5735
58- /// <summary>
59- /// When this is true, header values of type array or object generate separate parameters
60- /// for each value of the array or key-value pair of the map.
61- /// </summary>
62- public virtual bool Explode { get ; set ; }
36+ /// <inheritdoc/>
37+ public bool Explode { get ; set ; }
6338
64- /// <summary>
65- /// Determines whether the header value SHOULD allow reserved characters, as defined by RFC3986.
66- /// </summary>
67- public virtual bool AllowReserved { get ; set ; }
39+ /// <inheritdoc/>
40+ public bool AllowReserved { get ; set ; }
6841
69- /// <summary>
70- /// The schema defining the type used for the request body.
71- /// </summary>
72- public virtual OpenApiSchema Schema
73- {
74- get => _schema ;
75- set => _schema = value ;
76- }
42+ /// <inheritdoc/>
43+ public OpenApiSchema Schema { get ; set ; }
7744
78- /// <summary>
79- /// Example of the media type.
80- /// </summary>
81- public virtual JsonNode Example { get ; set ; }
45+ /// <inheritdoc/>
46+ public JsonNode Example { get ; set ; }
8247
83- /// <summary>
84- /// Examples of the media type.
85- /// </summary>
86- public virtual IDictionary < string , IOpenApiExample > Examples { get ; set ; } = new Dictionary < string , IOpenApiExample > ( ) ;
48+ /// <inheritdoc/>
49+ public IDictionary < string , IOpenApiExample > Examples { get ; set ; } = new Dictionary < string , IOpenApiExample > ( ) ;
8750
88- /// <summary>
89- /// A map containing the representations for the header.
90- /// </summary>
91- public virtual IDictionary < string , OpenApiMediaType > Content { get ; set ; } = new Dictionary < string , OpenApiMediaType > ( ) ;
51+ /// <inheritdoc/>
52+ public IDictionary < string , OpenApiMediaType > Content { get ; set ; } = new Dictionary < string , OpenApiMediaType > ( ) ;
9253
93- /// <summary>
94- /// This object MAY be extended with Specification Extensions.
95- /// </summary>
96- public virtual IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
54+ /// <inheritdoc/>
55+ public IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
9756
9857 /// <summary>
9958 /// Parameter-less constructor
@@ -103,18 +62,16 @@ public OpenApiHeader() { }
10362 /// <summary>
10463 /// Initializes a copy of an <see cref="OpenApiHeader"/> object
10564 /// </summary>
106- public OpenApiHeader ( OpenApiHeader header )
65+ public OpenApiHeader ( IOpenApiHeader header )
10766 {
108- UnresolvedReference = header ? . UnresolvedReference ?? UnresolvedReference ;
109- Reference = header ? . Reference != null ? new ( header ? . Reference ) : null ;
11067 Description = header ? . Description ?? Description ;
11168 Required = header ? . Required ?? Required ;
11269 Deprecated = header ? . Deprecated ?? Deprecated ;
11370 AllowEmptyValue = header ? . AllowEmptyValue ?? AllowEmptyValue ;
11471 Style = header ? . Style ?? Style ;
11572 Explode = header ? . Explode ?? Explode ;
11673 AllowReserved = header ? . AllowReserved ?? AllowReserved ;
117- _schema = header ? . Schema != null ? new ( header . Schema ) : null ;
74+ Schema = header ? . Schema != null ? new ( header . Schema ) : null ;
11875 Example = header ? . Example != null ? JsonNodeCloneHelper . Clone ( header . Example ) : null ;
11976 Examples = header ? . Examples != null ? new Dictionary < string , IOpenApiExample > ( header . Examples ) : null ;
12077 Content = header ? . Content != null ? new Dictionary < string , OpenApiMediaType > ( header . Content ) : null ;
@@ -124,20 +81,20 @@ public OpenApiHeader(OpenApiHeader header)
12481 /// <summary>
12582 /// Serialize <see cref="OpenApiHeader"/> to Open Api v3.1
12683 /// </summary>
127- public virtual void SerializeAsV31 ( IOpenApiWriter writer )
84+ public void SerializeAsV31 ( IOpenApiWriter writer )
12885 {
12986 SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV31 ( writer ) ) ;
13087 }
13188
13289 /// <summary>
13390 /// Serialize <see cref="OpenApiHeader"/> to Open Api v3.0
13491 /// </summary>
135- public virtual void SerializeAsV3 ( IOpenApiWriter writer )
92+ public void SerializeAsV3 ( IOpenApiWriter writer )
13693 {
13794 SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
13895 }
13996
140- internal virtual void SerializeInternal ( IOpenApiWriter writer , OpenApiSpecVersion version ,
97+ internal void SerializeInternal ( IOpenApiWriter writer , OpenApiSpecVersion version ,
14198 Action < IOpenApiWriter , IOpenApiSerializable > callback )
14299 {
143100 Utils . CheckArgumentNull ( writer ) ;
@@ -186,7 +143,7 @@ internal virtual void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersio
186143 /// <summary>
187144 /// Serialize to OpenAPI V2 document without using reference.
188145 /// </summary>
189- public virtual void SerializeAsV2 ( IOpenApiWriter writer )
146+ public void SerializeAsV2 ( IOpenApiWriter writer )
190147 {
191148 Utils . CheckArgumentNull ( writer ) ;
192149
0 commit comments