File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
src/Microsoft.OpenApi/Models Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ public OpenApiHeader(OpenApiHeader header)
109
109
Style = header ? . Style ?? Style ;
110
110
Explode = header ? . Explode ?? Explode ;
111
111
AllowReserved = header ? . AllowReserved ?? AllowReserved ;
112
- Schema = InitializeSchema ( ) ;
112
+ Schema = InitializeSchema ( header ? . Schema ) ;
113
113
Example = JsonNodeCloneHelper . Clone ( header ? . Example ) ;
114
114
Examples = header ? . Examples != null ? new Dictionary < string , OpenApiExample > ( header . Examples ) : null ;
115
115
Content = header ? . Content != null ? new Dictionary < string , OpenApiMediaType > ( header . Content ) : null ;
@@ -304,7 +304,7 @@ public void SerializeAsV2WithoutReference(IOpenApiWriter writer)
304
304
/// Clone a JSON schema instance
305
305
/// </summary>
306
306
/// <returns></returns>
307
- protected JsonSchema InitializeSchema ( )
307
+ protected JsonSchema InitializeSchema ( JsonSchema schema )
308
308
{
309
309
return JsonNodeCloneHelper . CloneJsonSchema ( Schema ) ;
310
310
}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public OpenApiMediaType() { }
57
57
/// </summary>
58
58
public OpenApiMediaType ( OpenApiMediaType mediaType )
59
59
{
60
- Schema = InitializeSchema ( ) ;
60
+ Schema = InitializeSchema ( mediaType ? . Schema ) ;
61
61
Example = JsonNodeCloneHelper . Clone ( mediaType ? . Example ) ;
62
62
Examples = mediaType ? . Examples != null ? new Dictionary < string , OpenApiExample > ( mediaType . Examples ) : null ;
63
63
Encoding = mediaType ? . Encoding != null ? new Dictionary < string , OpenApiEncoding > ( mediaType . Encoding ) : null ;
@@ -120,7 +120,7 @@ public void SerializeAsV2(IOpenApiWriter writer)
120
120
/// Clones a JSON schema instance
121
121
/// </summary>
122
122
/// <returns></returns>
123
- protected JsonSchema InitializeSchema ( )
123
+ protected JsonSchema InitializeSchema ( JsonSchema schema )
124
124
{
125
125
return JsonNodeCloneHelper . CloneJsonSchema ( Schema ) ;
126
126
}
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ public OpenApiParameter(OpenApiParameter parameter)
163
163
Style = parameter ? . Style ?? Style ;
164
164
Explode = parameter ? . Explode ?? Explode ;
165
165
AllowReserved = parameter ? . AllowReserved ?? AllowReserved ;
166
- Schema = JsonNodeCloneHelper . CloneJsonSchema ( parameter ? . Schema ) ;
166
+ Schema = InitializeSchema ( parameter ? . Schema ) ;
167
167
Examples = parameter ? . Examples != null ? new Dictionary < string , OpenApiExample > ( parameter . Examples ) : null ;
168
168
Example = JsonNodeCloneHelper . Clone ( parameter ? . Example ) ;
169
169
Content = parameter ? . Content != null ? new Dictionary < string , OpenApiMediaType > ( parameter . Content ) : null ;
@@ -447,6 +447,15 @@ public void SerializeAsV2WithoutReference(IOpenApiWriter writer)
447
447
448
448
return Style ;
449
449
}
450
+
451
+ /// <summary>
452
+ /// Clones an instance of a JSON schema
453
+ /// </summary>
454
+ /// <returns></returns>
455
+ protected JsonSchema InitializeSchema ( JsonSchema schema )
456
+ {
457
+ return JsonNodeCloneHelper . CloneJsonSchema ( schema ) ;
458
+ }
450
459
}
451
460
452
461
/// <summary>
You can’t perform that action at this time.
0 commit comments