|
1 | 1 | // Copyright (c) Microsoft Corporation. All rights reserved.
|
2 | 2 | // Licensed under the MIT license.
|
3 | 3 |
|
| 4 | +using System; |
4 | 5 | using System.Collections.Generic;
|
5 | 6 | using Microsoft.OpenApi.Any;
|
6 | 7 | using Microsoft.OpenApi.Extensions;
|
@@ -86,30 +87,28 @@ public class OpenApiHeader : IOpenApiSerializable, IOpenApiReferenceable, IOpenA
|
86 | 87 | /// </summary>
|
87 | 88 | public IDictionary<string, IOpenApiExtension> Extensions { get; set; } = new Dictionary<string, IOpenApiExtension>();
|
88 | 89 |
|
89 |
| - /// <summary> |
90 |
| - /// Parameter-less constructor |
91 |
| - /// </summary> |
92 |
| - public OpenApiHeader() {} |
93 |
| - |
94 | 90 | /// <summary>
|
95 | 91 | /// Initializes a copy of an <see cref="OpenApiHeader"/> object
|
96 | 92 | /// </summary>
|
97 |
| - public OpenApiHeader(OpenApiHeader header) |
| 93 | + public Object Clone() |
98 | 94 | {
|
99 |
| - UnresolvedReference = header.UnresolvedReference; |
100 |
| - Reference = header.Reference; |
101 |
| - Description = header.Description; |
102 |
| - Required = header.Required; |
103 |
| - Deprecated = header.Deprecated; |
104 |
| - AllowEmptyValue = header.AllowEmptyValue; |
105 |
| - Style = header.Style; |
106 |
| - Explode = header.Explode; |
107 |
| - AllowReserved = header.AllowReserved; |
108 |
| - Schema = header.Schema; |
109 |
| - Example = header.Example; |
110 |
| - Examples = header.Examples; |
111 |
| - Content = header.Content; |
112 |
| - Extensions = header.Extensions; |
| 95 | + return new OpenApiHeader |
| 96 | + { |
| 97 | + UnresolvedReference = UnresolvedReference, |
| 98 | + Reference = Reference, |
| 99 | + Description = Description.Clone() as string, |
| 100 | + Required = Required, |
| 101 | + Deprecated = Deprecated, |
| 102 | + AllowEmptyValue = AllowEmptyValue, |
| 103 | + Style = Style, |
| 104 | + Explode = Explode, |
| 105 | + AllowReserved = AllowReserved, |
| 106 | + Schema = Schema, |
| 107 | + Example = Example, |
| 108 | + Examples = Examples, |
| 109 | + Content = Content, |
| 110 | + Extensions = Extensions |
| 111 | + }; |
113 | 112 | }
|
114 | 113 |
|
115 | 114 | /// <summary>
|
|
0 commit comments