@@ -83,6 +83,11 @@ public class OpenApiSchema : IOpenApiAnnotatable, IOpenApiExtensible, IOpenApiRe
8383 /// </summary>
8484 public virtual JsonSchemaType ? Type { get ; set ; }
8585
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+
8691 /// <summary>
8792 /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
8893 /// While relying on JSON Schema's defined formats,
@@ -347,6 +352,7 @@ public OpenApiSchema(OpenApiSchema schema)
347352 {
348353 Title = schema ? . Title ?? Title ;
349354 Id = schema ? . Id ?? Id ;
355+ Const = schema ? . Const ?? Const ;
350356 Schema = schema ? . Schema ?? Schema ;
351357 Comment = schema ? . Comment ?? Comment ;
352358 Vocabulary = schema ? . Vocabulary != null ? new Dictionary < string , bool > ( schema . Vocabulary ) : null ;
@@ -563,6 +569,7 @@ internal void WriteV31Properties(IOpenApiWriter writer)
563569 writer . WriteProperty ( OpenApiConstants . Id , Id ) ;
564570 writer . WriteProperty ( OpenApiConstants . DollarSchema , Schema ) ;
565571 writer . WriteProperty ( OpenApiConstants . Comment , Comment ) ;
572+ writer . WriteProperty ( OpenApiConstants . Const , Const ) ;
566573 writer . WriteOptionalMap ( OpenApiConstants . Vocabulary , Vocabulary , ( w , s ) => w . WriteValue ( s ) ) ;
567574 writer . WriteOptionalMap ( OpenApiConstants . Defs , Definitions , ( w , s ) => s . SerializeAsV31 ( w ) ) ;
568575 writer . WriteProperty ( OpenApiConstants . DynamicRef , DynamicRef ) ;
0 commit comments