@@ -17,10 +17,6 @@ namespace Microsoft.OpenApi.Models
17
17
/// </summary>
18
18
public class OpenApiSchema : IOpenApiAnnotatable , IOpenApiExtensible , IOpenApiReferenceable
19
19
{
20
- private JsonNode _example ;
21
- private JsonNode _default ;
22
- private IList < JsonNode > _examples ;
23
-
24
20
/// <summary>
25
21
/// Follow JSON Schema definition. Short text providing information about the data.
26
22
/// </summary>
@@ -148,11 +144,7 @@ public class OpenApiSchema : IOpenApiAnnotatable, IOpenApiExtensible, IOpenApiRe
148
144
/// Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level.
149
145
/// For example, if type is string, then default can be "foo" but cannot be 1.
150
146
/// </summary>
151
- public virtual JsonNode Default
152
- {
153
- get => _default ;
154
- set => _default = value ;
155
- }
147
+ public virtual JsonNode Default { get ; set ; }
156
148
157
149
/// <summary>
158
150
/// Relevant only for Schema "properties" definitions. Declares the property as "read only".
@@ -273,22 +265,14 @@ public virtual JsonNode Default
273
265
/// To represent examples that cannot be naturally represented in JSON or YAML,
274
266
/// a string value can be used to contain the example with escaping where necessary.
275
267
/// </summary>
276
- public virtual JsonNode Example
277
- {
278
- get => _example ;
279
- set => _example = value ;
280
- }
268
+ public virtual JsonNode Example { get ; set ; }
281
269
282
270
/// <summary>
283
271
/// A free-form property to include examples of an instance for this schema.
284
272
/// To represent examples that cannot be naturally represented in JSON or YAML,
285
273
/// a list of values can be used to contain the examples with escaping where necessary.
286
274
/// </summary>
287
- public virtual IList < JsonNode > Examples
288
- {
289
- get => _examples ;
290
- set => _examples = value ;
291
- }
275
+ public virtual IList < JsonNode > Examples { get ; set ; }
292
276
293
277
/// <summary>
294
278
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
@@ -378,7 +362,7 @@ public OpenApiSchema(OpenApiSchema schema)
378
362
MinLength = schema ? . MinLength ?? MinLength ;
379
363
Pattern = schema ? . Pattern ?? Pattern ;
380
364
MultipleOf = schema ? . MultipleOf ?? MultipleOf ;
381
- _default = schema ? . Default != null ? JsonNodeCloneHelper . Clone ( schema ? . Default ) : null ;
365
+ Default = schema ? . Default != null ? JsonNodeCloneHelper . Clone ( schema ? . Default ) : null ;
382
366
ReadOnly = schema ? . ReadOnly ?? ReadOnly ;
383
367
WriteOnly = schema ? . WriteOnly ?? WriteOnly ;
384
368
AllOf = schema ? . AllOf != null ? new List < OpenApiSchema > ( schema . AllOf ) : null ;
@@ -397,8 +381,8 @@ public OpenApiSchema(OpenApiSchema schema)
397
381
AdditionalPropertiesAllowed = schema ? . AdditionalPropertiesAllowed ?? AdditionalPropertiesAllowed ;
398
382
AdditionalProperties = schema ? . AdditionalProperties != null ? new ( schema ? . AdditionalProperties ) : null ;
399
383
Discriminator = schema ? . Discriminator != null ? new ( schema ? . Discriminator ) : null ;
400
- _example = schema ? . Example != null ? JsonNodeCloneHelper . Clone ( schema ? . Example ) : null ;
401
- _examples = schema ? . Examples != null ? new List < JsonNode > ( schema . Examples ) : null ;
384
+ Example = schema ? . Example != null ? JsonNodeCloneHelper . Clone ( schema ? . Example ) : null ;
385
+ Examples = schema ? . Examples != null ? new List < JsonNode > ( schema . Examples ) : null ;
402
386
Enum = schema ? . Enum != null ? new List < JsonNode > ( schema . Enum ) : null ;
403
387
Nullable = schema ? . Nullable ?? Nullable ;
404
388
ExternalDocs = schema ? . ExternalDocs != null ? new ( schema ? . ExternalDocs ) : null ;
0 commit comments