File tree Expand file tree Collapse file tree 5 files changed +18
-13
lines changed
src/Microsoft.OpenApi/Models Expand file tree Collapse file tree 5 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 44using System . Collections . Generic ;
55using Microsoft . OpenApi . Any ;
66using Microsoft . OpenApi . Extensions ;
7+ using Microsoft . OpenApi . Helpers ;
78using Microsoft . OpenApi . Interfaces ;
89using Microsoft . OpenApi . Writers ;
910
@@ -64,11 +65,11 @@ public OpenApiEncoding() {}
6465 public OpenApiEncoding ( OpenApiEncoding encoding )
6566 {
6667 ContentType = encoding ? . ContentType ?? ContentType ;
67- Headers = encoding ? . Headers != null ? new Dictionary < string , OpenApiHeader > ( encoding . Headers ) : null ;
68+ Headers = encoding ? . Headers != null ? DictionaryCloneHelper . Clone ( encoding . Headers ) : null ;
6869 Style = encoding ? . Style ?? Style ;
6970 Explode = encoding ? . Explode ?? Explode ;
7071 AllowReserved = encoding ? . AllowReserved ?? AllowReserved ;
71- Extensions = encoding ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( encoding . Extensions ) : null ;
72+ Extensions = encoding ? . Extensions != null ? DictionaryCloneHelper . Clone ( encoding . Extensions ) : null ;
7273 }
7374
7475 /// <summary>
Original file line number Diff line number Diff line change 33
44using System . Collections . Generic ;
55using Microsoft . OpenApi . Any ;
6+ using Microsoft . OpenApi . Helpers ;
67using Microsoft . OpenApi . Interfaces ;
78using Microsoft . OpenApi . Writers ;
89
@@ -68,7 +69,7 @@ public OpenApiExample(OpenApiExample example)
6869 Description = example ? . Description ?? Description ;
6970 Value = OpenApiAnyCloneHelper . CloneFromCopyConstructor ( example ? . Value ) ;
7071 ExternalValue = example ? . ExternalValue ?? ExternalValue ;
71- Extensions = example ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( example . Extensions ) : null ;
72+ Extensions = example ? . Extensions != null ? DictionaryCloneHelper . Clone ( example . Extensions ) : null ;
7273 Reference = example ? . Reference != null ? new ( example ? . Reference ) : null ;
7374 UnresolvedReference = example ? . UnresolvedReference ?? UnresolvedReference ;
7475 }
Original file line number Diff line number Diff line change 44using System . Collections . Generic ;
55using Microsoft . OpenApi . Any ;
66using Microsoft . OpenApi . Extensions ;
7+ using Microsoft . OpenApi . Helpers ;
78using Microsoft . OpenApi . Interfaces ;
89using Microsoft . OpenApi . Writers ;
910
@@ -107,9 +108,9 @@ public OpenApiHeader(OpenApiHeader header)
107108 AllowReserved = header ? . AllowReserved ?? AllowReserved ;
108109 Schema = header ? . Schema != null ? new ( header ? . Schema ) : null ;
109110 Example = OpenApiAnyCloneHelper . CloneFromCopyConstructor ( header ? . Example ) ;
110- Examples = header ? . Examples != null ? new Dictionary < string , OpenApiExample > ( header . Examples ) : null ;
111- Content = header ? . Content != null ? new Dictionary < string , OpenApiMediaType > ( header . Content ) : null ;
112- Extensions = header ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( header . Extensions ) : null ;
111+ Examples = header ? . Examples != null ? DictionaryCloneHelper . Clone ( header . Examples ) : null ;
112+ Content = header ? . Content != null ? DictionaryCloneHelper . Clone ( header . Content ) : null ;
113+ Extensions = header ? . Extensions != null ? DictionaryCloneHelper . Clone ( header . Extensions ) : null ;
113114 }
114115
115116 /// <summary>
Original file line number Diff line number Diff line change 33
44using System . Collections . Generic ;
55using Microsoft . OpenApi . Any ;
6+ using Microsoft . OpenApi . Helpers ;
67using Microsoft . OpenApi . Interfaces ;
78using Microsoft . OpenApi . Writers ;
89
@@ -55,9 +56,9 @@ public OpenApiMediaType(OpenApiMediaType mediaType)
5556 {
5657 Schema = mediaType ? . Schema != null ? new ( mediaType ? . Schema ) : null ;
5758 Example = OpenApiAnyCloneHelper . CloneFromCopyConstructor ( mediaType ? . Example ) ;
58- Examples = mediaType ? . Examples != null ? new Dictionary < string , OpenApiExample > ( mediaType . Examples ) : null ;
59- Encoding = mediaType ? . Encoding != null ? new Dictionary < string , OpenApiEncoding > ( mediaType . Encoding ) : null ;
60- Extensions = mediaType ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( mediaType . Extensions ) : null ;
59+ Examples = mediaType ? . Examples != null ? DictionaryCloneHelper . Clone ( mediaType . Examples ) : null ;
60+ Encoding = mediaType ? . Encoding != null ? DictionaryCloneHelper . Clone ( mediaType . Encoding ) : null ;
61+ Extensions = mediaType ? . Extensions != null ? DictionaryCloneHelper . Clone ( mediaType . Extensions ) : null ;
6162 }
6263
6364 /// <summary>
Original file line number Diff line number Diff line change 33
44using System . Collections . Generic ;
55using System . Linq ;
6+ using Microsoft . OpenApi . Helpers ;
67using Microsoft . OpenApi . Interfaces ;
78using Microsoft . OpenApi . Writers ;
89
@@ -62,10 +63,10 @@ public OpenApiResponse() {}
6263 public OpenApiResponse ( OpenApiResponse response )
6364 {
6465 Description = response ? . Description ?? Description ;
65- Headers = response ? . Headers != null ? new Dictionary < string , OpenApiHeader > ( response . Headers ) : null ;
66- Content = response ? . Content != null ? new Dictionary < string , OpenApiMediaType > ( response . Content ) : null ;
67- Links = response ? . Links != null ? new Dictionary < string , OpenApiLink > ( response . Links ) : null ;
68- Extensions = response ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( response . Extensions ) : null ;
66+ Headers = response ? . Headers != null ? DictionaryCloneHelper . Clone ( response . Headers ) : null ;
67+ Content = response ? . Content != null ? DictionaryCloneHelper . Clone ( response . Content ) : null ;
68+ Links = response ? . Links != null ? DictionaryCloneHelper . Clone ( response . Links ) : null ;
69+ Extensions = response ? . Extensions != null ? DictionaryCloneHelper . Clone ( response . Extensions ) : null ;
6970 UnresolvedReference = response ? . UnresolvedReference ?? UnresolvedReference ;
7071 Reference = response ? . Reference != null ? new ( response ? . Reference ) : null ;
7172 }
You can’t perform that action at this time.
0 commit comments