@@ -83,6 +83,11 @@ public class OpenApiSchema : IOpenApiAnnotatable, IOpenApiExtensible, IOpenApiRe
83
83
/// </summary>
84
84
public virtual JsonSchemaType ? Type { get ; set ; }
85
85
86
+ /// <summary>
87
+ /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation
88
+ /// </summary>
89
+ public virtual string Const { get ; set ; }
90
+
86
91
/// <summary>
87
92
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
88
93
/// While relying on JSON Schema's defined formats,
@@ -347,6 +352,7 @@ public OpenApiSchema(OpenApiSchema schema)
347
352
{
348
353
Title = schema ? . Title ?? Title ;
349
354
Id = schema ? . Id ?? Id ;
355
+ Const = schema ? . Const ?? Const ;
350
356
Schema = schema ? . Schema ?? Schema ;
351
357
Comment = schema ? . Comment ?? Comment ;
352
358
Vocabulary = schema ? . Vocabulary != null ? new Dictionary < string , bool > ( schema . Vocabulary ) : null ;
@@ -563,6 +569,7 @@ internal void WriteV31Properties(IOpenApiWriter writer)
563
569
writer . WriteProperty ( OpenApiConstants . Id , Id ) ;
564
570
writer . WriteProperty ( OpenApiConstants . DollarSchema , Schema ) ;
565
571
writer . WriteProperty ( OpenApiConstants . Comment , Comment ) ;
572
+ writer . WriteProperty ( OpenApiConstants . Const , Const ) ;
566
573
writer . WriteOptionalMap ( OpenApiConstants . Vocabulary , Vocabulary , ( w , s ) => w . WriteValue ( s ) ) ;
567
574
writer . WriteOptionalMap ( OpenApiConstants . Defs , Definitions , ( w , s ) => s . SerializeAsV31 ( w ) ) ;
568
575
writer . WriteProperty ( OpenApiConstants . DynamicRef , DynamicRef ) ;
0 commit comments