@@ -16,84 +16,43 @@ namespace Microsoft.OpenApi.Models
16
16
/// Header Object.
17
17
/// The Header Object follows the structure of the Parameter Object.
18
18
/// </summary>
19
- public class OpenApiHeader : IOpenApiReferenceable , IOpenApiExtensible
19
+ public class OpenApiHeader : IOpenApiHeader , IOpenApiReferenceable , IOpenApiExtensible
20
20
{
21
- private OpenApiSchema _schema ;
21
+ /// <inheritdoc/>
22
+ public string Description { get ; set ; }
22
23
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 ; }
37
26
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 ; }
47
29
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 ; }
52
32
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 ; }
57
35
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 ; }
63
38
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 ; }
68
41
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 ; }
77
44
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 ; }
82
47
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 > ( ) ;
87
50
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 > ( ) ;
92
53
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 > ( ) ;
97
56
98
57
/// <summary>
99
58
/// Parameter-less constructor
@@ -103,18 +62,16 @@ public OpenApiHeader() { }
103
62
/// <summary>
104
63
/// Initializes a copy of an <see cref="OpenApiHeader"/> object
105
64
/// </summary>
106
- public OpenApiHeader ( OpenApiHeader header )
65
+ public OpenApiHeader ( IOpenApiHeader header )
107
66
{
108
- UnresolvedReference = header ? . UnresolvedReference ?? UnresolvedReference ;
109
- Reference = header ? . Reference != null ? new ( header ? . Reference ) : null ;
110
67
Description = header ? . Description ?? Description ;
111
68
Required = header ? . Required ?? Required ;
112
69
Deprecated = header ? . Deprecated ?? Deprecated ;
113
70
AllowEmptyValue = header ? . AllowEmptyValue ?? AllowEmptyValue ;
114
71
Style = header ? . Style ?? Style ;
115
72
Explode = header ? . Explode ?? Explode ;
116
73
AllowReserved = header ? . AllowReserved ?? AllowReserved ;
117
- _schema = header ? . Schema != null ? new ( header . Schema ) : null ;
74
+ Schema = header ? . Schema != null ? new ( header . Schema ) : null ;
118
75
Example = header ? . Example != null ? JsonNodeCloneHelper . Clone ( header . Example ) : null ;
119
76
Examples = header ? . Examples != null ? new Dictionary < string , IOpenApiExample > ( header . Examples ) : null ;
120
77
Content = header ? . Content != null ? new Dictionary < string , OpenApiMediaType > ( header . Content ) : null ;
@@ -124,20 +81,20 @@ public OpenApiHeader(OpenApiHeader header)
124
81
/// <summary>
125
82
/// Serialize <see cref="OpenApiHeader"/> to Open Api v3.1
126
83
/// </summary>
127
- public virtual void SerializeAsV31 ( IOpenApiWriter writer )
84
+ public void SerializeAsV31 ( IOpenApiWriter writer )
128
85
{
129
86
SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV31 ( writer ) ) ;
130
87
}
131
88
132
89
/// <summary>
133
90
/// Serialize <see cref="OpenApiHeader"/> to Open Api v3.0
134
91
/// </summary>
135
- public virtual void SerializeAsV3 ( IOpenApiWriter writer )
92
+ public void SerializeAsV3 ( IOpenApiWriter writer )
136
93
{
137
94
SerializeInternal ( writer , OpenApiSpecVersion . OpenApi3_0 , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
138
95
}
139
96
140
- internal virtual void SerializeInternal ( IOpenApiWriter writer , OpenApiSpecVersion version ,
97
+ internal void SerializeInternal ( IOpenApiWriter writer , OpenApiSpecVersion version ,
141
98
Action < IOpenApiWriter , IOpenApiSerializable > callback )
142
99
{
143
100
Utils . CheckArgumentNull ( writer ) ;
@@ -186,7 +143,7 @@ internal virtual void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersio
186
143
/// <summary>
187
144
/// Serialize to OpenAPI V2 document without using reference.
188
145
/// </summary>
189
- public virtual void SerializeAsV2 ( IOpenApiWriter writer )
146
+ public void SerializeAsV2 ( IOpenApiWriter writer )
190
147
{
191
148
Utils . CheckArgumentNull ( writer ) ;
192
149
0 commit comments