@@ -186,60 +186,61 @@ public OpenApiSchema() { }
186186 /// Initializes a copy of <see cref="IOpenApiSchema"/> object
187187 /// </summary>
188188 /// <param name="schema">The schema object to copy from.</param>
189- public OpenApiSchema ( IOpenApiSchema schema )
189+ internal OpenApiSchema ( IOpenApiSchema schema )
190190 {
191- Title = schema ? . Title ?? Title ;
192- Id = schema ? . Id ?? Id ;
193- Const = schema ? . Const ?? Const ;
194- Schema = schema ? . Schema ?? Schema ;
195- Comment = schema ? . Comment ?? Comment ;
196- Vocabulary = schema ? . Vocabulary != null ? new Dictionary < string , bool > ( schema . Vocabulary ) : null ;
197- DynamicAnchor = schema ? . DynamicAnchor ?? DynamicAnchor ;
198- DynamicRef = schema ? . DynamicRef ?? DynamicRef ;
199- Definitions = schema ? . Definitions != null ? new Dictionary < string , IOpenApiSchema > ( schema . Definitions ) : null ;
200- UnevaluatedProperties = schema ? . UnevaluatedProperties ?? UnevaluatedProperties ;
201- V31ExclusiveMaximum = schema ? . V31ExclusiveMaximum ?? V31ExclusiveMaximum ;
202- V31ExclusiveMinimum = schema ? . V31ExclusiveMinimum ?? V31ExclusiveMinimum ;
203- Type = schema ? . Type ?? Type ;
204- Format = schema ? . Format ?? Format ;
205- Description = schema ? . Description ?? Description ;
206- Maximum = schema ? . Maximum ?? Maximum ;
207- ExclusiveMaximum = schema ? . ExclusiveMaximum ?? ExclusiveMaximum ;
208- Minimum = schema ? . Minimum ?? Minimum ;
209- ExclusiveMinimum = schema ? . ExclusiveMinimum ?? ExclusiveMinimum ;
210- MaxLength = schema ? . MaxLength ?? MaxLength ;
211- MinLength = schema ? . MinLength ?? MinLength ;
212- Pattern = schema ? . Pattern ?? Pattern ;
213- MultipleOf = schema ? . MultipleOf ?? MultipleOf ;
214- Default = schema ? . Default != null ? JsonNodeCloneHelper . Clone ( schema ? . Default ) : null ;
215- ReadOnly = schema ? . ReadOnly ?? ReadOnly ;
216- WriteOnly = schema ? . WriteOnly ?? WriteOnly ;
217- AllOf = schema ? . AllOf != null ? new List < IOpenApiSchema > ( schema . AllOf ) : null ;
218- OneOf = schema ? . OneOf != null ? new List < IOpenApiSchema > ( schema . OneOf ) : null ;
219- AnyOf = schema ? . AnyOf != null ? new List < IOpenApiSchema > ( schema . AnyOf ) : null ;
220- Not = schema ? . Not != null ? new OpenApiSchema ( schema ? . Not ) : null ;
221- Required = schema ? . Required != null ? new HashSet < string > ( schema . Required ) : null ;
222- Items = schema ? . Items != null ? new OpenApiSchema ( schema ? . Items ) : null ;
223- MaxItems = schema ? . MaxItems ?? MaxItems ;
224- MinItems = schema ? . MinItems ?? MinItems ;
225- UniqueItems = schema ? . UniqueItems ?? UniqueItems ;
226- Properties = schema ? . Properties != null ? new Dictionary < string , IOpenApiSchema > ( schema . Properties ) : null ;
227- PatternProperties = schema ? . PatternProperties != null ? new Dictionary < string , IOpenApiSchema > ( schema . PatternProperties ) : null ;
228- MaxProperties = schema ? . MaxProperties ?? MaxProperties ;
229- MinProperties = schema ? . MinProperties ?? MinProperties ;
230- AdditionalPropertiesAllowed = schema ? . AdditionalPropertiesAllowed ?? AdditionalPropertiesAllowed ;
231- AdditionalProperties = schema ? . AdditionalProperties != null ? new OpenApiSchema ( schema ? . AdditionalProperties ) : null ;
232- Discriminator = schema ? . Discriminator != null ? new ( schema ? . Discriminator ) : null ;
233- Example = schema ? . Example != null ? JsonNodeCloneHelper . Clone ( schema ? . Example ) : null ;
234- Examples = schema ? . Examples != null ? new List < JsonNode > ( schema . Examples ) : null ;
235- Enum = schema ? . Enum != null ? new List < JsonNode > ( schema . Enum ) : null ;
236- Nullable = schema ? . Nullable ?? Nullable ;
237- ExternalDocs = schema ? . ExternalDocs != null ? new ( schema ? . ExternalDocs ) : null ;
238- Deprecated = schema ? . Deprecated ?? Deprecated ;
239- Xml = schema ? . Xml != null ? new ( schema ? . Xml ) : null ;
240- Extensions = schema ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( schema . Extensions ) : null ;
241- Annotations = schema ? . Annotations != null ? new Dictionary < string , object > ( schema ? . Annotations ) : null ;
242- UnrecognizedKeywords = schema ? . UnrecognizedKeywords != null ? new Dictionary < string , JsonNode > ( schema ? . UnrecognizedKeywords ) : null ;
191+ Utils . CheckArgumentNull ( schema ) ;
192+ Title = schema . Title ?? Title ;
193+ Id = schema . Id ?? Id ;
194+ Const = schema . Const ?? Const ;
195+ Schema = schema . Schema ?? Schema ;
196+ Comment = schema . Comment ?? Comment ;
197+ Vocabulary = schema . Vocabulary != null ? new Dictionary < string , bool > ( schema . Vocabulary ) : null ;
198+ DynamicAnchor = schema . DynamicAnchor ?? DynamicAnchor ;
199+ DynamicRef = schema . DynamicRef ?? DynamicRef ;
200+ Definitions = schema . Definitions != null ? new Dictionary < string , IOpenApiSchema > ( schema . Definitions ) : null ;
201+ UnevaluatedProperties = schema . UnevaluatedProperties ;
202+ V31ExclusiveMaximum = schema . V31ExclusiveMaximum ?? V31ExclusiveMaximum ;
203+ V31ExclusiveMinimum = schema . V31ExclusiveMinimum ?? V31ExclusiveMinimum ;
204+ Type = schema . Type ?? Type ;
205+ Format = schema . Format ?? Format ;
206+ Description = schema . Description ?? Description ;
207+ Maximum = schema . Maximum ?? Maximum ;
208+ ExclusiveMaximum = schema . ExclusiveMaximum ?? ExclusiveMaximum ;
209+ Minimum = schema . Minimum ?? Minimum ;
210+ ExclusiveMinimum = schema . ExclusiveMinimum ?? ExclusiveMinimum ;
211+ MaxLength = schema . MaxLength ?? MaxLength ;
212+ MinLength = schema . MinLength ?? MinLength ;
213+ Pattern = schema . Pattern ?? Pattern ;
214+ MultipleOf = schema . MultipleOf ?? MultipleOf ;
215+ Default = schema . Default != null ? JsonNodeCloneHelper . Clone ( schema . Default ) : null ;
216+ ReadOnly = schema . ReadOnly ;
217+ WriteOnly = schema . WriteOnly ;
218+ AllOf = schema . AllOf != null ? new List < IOpenApiSchema > ( schema . AllOf ) : null ;
219+ OneOf = schema . OneOf != null ? new List < IOpenApiSchema > ( schema . OneOf ) : null ;
220+ AnyOf = schema . AnyOf != null ? new List < IOpenApiSchema > ( schema . AnyOf ) : null ;
221+ Not = schema . Not ? . CreateShallowCopy ( ) ;
222+ Required = schema . Required != null ? new HashSet < string > ( schema . Required ) : null ;
223+ Items = schema . Items ? . CreateShallowCopy ( ) ;
224+ MaxItems = schema . MaxItems ?? MaxItems ;
225+ MinItems = schema . MinItems ?? MinItems ;
226+ UniqueItems = schema . UniqueItems ?? UniqueItems ;
227+ Properties = schema . Properties != null ? new Dictionary < string , IOpenApiSchema > ( schema . Properties ) : null ;
228+ PatternProperties = schema . PatternProperties != null ? new Dictionary < string , IOpenApiSchema > ( schema . PatternProperties ) : null ;
229+ MaxProperties = schema . MaxProperties ?? MaxProperties ;
230+ MinProperties = schema . MinProperties ?? MinProperties ;
231+ AdditionalPropertiesAllowed = schema . AdditionalPropertiesAllowed ;
232+ AdditionalProperties = schema . AdditionalProperties ? . CreateShallowCopy ( ) ;
233+ Discriminator = schema . Discriminator != null ? new ( schema . Discriminator ) : null ;
234+ Example = schema . Example != null ? JsonNodeCloneHelper . Clone ( schema . Example ) : null ;
235+ Examples = schema . Examples != null ? new List < JsonNode > ( schema . Examples ) : null ;
236+ Enum = schema . Enum != null ? new List < JsonNode > ( schema . Enum ) : null ;
237+ Nullable = schema . Nullable ;
238+ ExternalDocs = schema . ExternalDocs != null ? new ( schema . ExternalDocs ) : null ;
239+ Deprecated = schema . Deprecated ;
240+ Xml = schema . Xml != null ? new ( schema . Xml ) : null ;
241+ Extensions = schema . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( schema . Extensions ) : null ;
242+ Annotations = schema . Annotations != null ? new Dictionary < string , object > ( schema . Annotations ) : null ;
243+ UnrecognizedKeywords = schema . UnrecognizedKeywords != null ? new Dictionary < string , JsonNode > ( schema . UnrecognizedKeywords ) : null ;
243244 }
244245
245246 /// <inheritdoc />
@@ -736,5 +737,11 @@ private void DowncastTypeArrayToV2OrV3(JsonSchemaType schemaType, IOpenApiWriter
736737 }
737738 }
738739 }
740+
741+ /// <inheritdoc/>
742+ public IOpenApiSchema CreateShallowCopy ( )
743+ {
744+ return new OpenApiSchema ( this ) ;
745+ }
739746 }
740747}
0 commit comments