@@ -43,7 +43,7 @@ public class OpenApiSchema : IOpenApiAnnotatable, IOpenApiExtensible, IOpenApiRe
4343        /// <summary> 
4444        /// $vocabulary- used in meta-schemas to identify the vocabularies available for use in schemas described by that meta-schema. 
4545        /// </summary> 
46-         public  virtual  string  Vocabulary  {  get ;  set ;  } 
46+         public  virtual  IDictionary < string ,   bool >  Vocabulary  {  get ;  set ;  } 
4747
4848        /// <summary> 
4949        /// $dynamicRef - an applicator that allows for deferring the full resolution until runtime, at which point it is resolved each time it is encountered while evaluating an instance 
@@ -55,16 +55,6 @@ public class OpenApiSchema : IOpenApiAnnotatable, IOpenApiExtensible, IOpenApiRe
5555        /// </summary> 
5656        public  virtual  string  DynamicAnchor  {  get ;  set ;  } 
5757
58-         /// <summary> 
59-         /// $recursiveAnchor - used to construct recursive schemas i.e one that has a reference to its own root, identified by the empty fragment URI reference ("#") 
60-         /// </summary> 
61-         public  virtual  string  RecursiveAnchor  {  get ;  set ;  } 
62- 
63-         /// <summary> 
64-         /// $recursiveRef - used to construct recursive schemas i.e one that has a reference to its own root, identified by the empty fragment URI reference ("#") 
65-         /// </summary> 
66-         public  virtual  string  RecursiveRef  {  get ;  set ;  } 
67- 
6858        /// <summary> 
6959        /// $defs - reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema.  
7060        /// The keyword does not directly affect the validation result 
@@ -358,11 +348,9 @@ public OpenApiSchema(OpenApiSchema schema)
358348            Id  =  schema ? . Id  ??  Id ; 
359349            Schema  =  schema ? . Schema  ??  Schema ; 
360350            Comment  =  schema ? . Comment  ??  Comment ; 
361-             Vocabulary  =  schema ? . Vocabulary  ??   Vocabulary ; 
351+             Vocabulary  =  schema ? . Vocabulary  !=   null   ?   new   Dictionary < string ,   bool > ( schema . Vocabulary )   :   null ; 
362352            DynamicAnchor  =  schema ? . DynamicAnchor  ??  DynamicAnchor ; 
363353            DynamicRef  =  schema ? . DynamicRef  ??  DynamicRef ; 
364-             RecursiveAnchor  =  schema ? . RecursiveAnchor  ??  RecursiveAnchor ; 
365-             RecursiveRef  =  schema ? . RecursiveRef  ??  RecursiveRef ; 
366354            Definitions  =  schema ? . Definitions  !=  null  ?  new  Dictionary < string ,  OpenApiSchema > ( schema . Definitions )  :  null ; 
367355            UnevaluatedProperties  =  schema ? . UnevaluatedProperties  ??  UnevaluatedProperties ; 
368356            V31ExclusiveMaximum  =  schema ? . V31ExclusiveMaximum  ??  V31ExclusiveMaximum ; 
@@ -490,30 +478,30 @@ public void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version,
490478            SerializeTypeProperty ( Type ,  writer ,  version ) ; 
491479
492480            // allOf 
493-             writer . WriteOptionalCollection ( OpenApiConstants . AllOf ,  AllOf ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
481+             writer . WriteOptionalCollection ( OpenApiConstants . AllOf ,  AllOf ,  callback ) ; 
494482
495483            // anyOf 
496-             writer . WriteOptionalCollection ( OpenApiConstants . AnyOf ,  AnyOf ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
484+             writer . WriteOptionalCollection ( OpenApiConstants . AnyOf ,  AnyOf ,  callback ) ; 
497485
498486            // oneOf 
499-             writer . WriteOptionalCollection ( OpenApiConstants . OneOf ,  OneOf ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
487+             writer . WriteOptionalCollection ( OpenApiConstants . OneOf ,  OneOf ,  callback ) ; 
500488
501489            // not 
502-             writer . WriteOptionalObject ( OpenApiConstants . Not ,  Not ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
490+             writer . WriteOptionalObject ( OpenApiConstants . Not ,  Not ,  callback ) ; 
503491
504492            // items 
505-             writer . WriteOptionalObject ( OpenApiConstants . Items ,  Items ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
493+             writer . WriteOptionalObject ( OpenApiConstants . Items ,  Items ,  callback ) ; 
506494
507495            // properties 
508-             writer . WriteOptionalMap ( OpenApiConstants . Properties ,  Properties ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
496+             writer . WriteOptionalMap ( OpenApiConstants . Properties ,  Properties ,  callback ) ; 
509497
510498            // additionalProperties 
511499            if  ( AdditionalPropertiesAllowed ) 
512500            { 
513501                writer . WriteOptionalObject ( 
514502                    OpenApiConstants . AdditionalProperties , 
515503                    AdditionalProperties , 
516-                     ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
504+                     callback ) ; 
517505            } 
518506            else 
519507            { 
@@ -536,7 +524,7 @@ public void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version,
536524            } 
537525
538526            // discriminator 
539-             writer . WriteOptionalObject ( OpenApiConstants . Discriminator ,  Discriminator ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
527+             writer . WriteOptionalObject ( OpenApiConstants . Discriminator ,  Discriminator ,  callback ) ; 
540528
541529            // readOnly 
542530            writer . WriteProperty ( OpenApiConstants . ReadOnly ,  ReadOnly ,  false ) ; 
@@ -548,7 +536,7 @@ public void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version,
548536            writer . WriteOptionalObject ( OpenApiConstants . Xml ,  Xml ,  ( w ,  s )  =>  s . SerializeAsV2 ( w ) ) ; 
549537
550538            // externalDocs 
551-             writer . WriteOptionalObject ( OpenApiConstants . ExternalDocs ,  ExternalDocs ,  ( w ,   s )   =>   s . SerializeAsV3 ( w ) ) ; 
539+             writer . WriteOptionalObject ( OpenApiConstants . ExternalDocs ,  ExternalDocs ,  callback ) ; 
552540
553541            // example 
554542            writer . WriteOptionalObject ( OpenApiConstants . Example ,  Example ,  ( w ,  e )  =>  w . WriteAny ( e ) ) ; 
@@ -557,7 +545,7 @@ public void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version,
557545            writer . WriteProperty ( OpenApiConstants . Deprecated ,  Deprecated ,  false ) ; 
558546
559547            // extensions 
560-             writer . WriteExtensions ( Extensions ,  OpenApiSpecVersion . OpenApi3_0 ) ; 
548+             writer . WriteExtensions ( Extensions ,  version ) ; 
561549
562550            writer . WriteEndObject ( ) ; 
563551        } 
@@ -574,12 +562,10 @@ internal void WriteV31Properties(IOpenApiWriter writer)
574562            writer . WriteProperty ( OpenApiConstants . Id ,  Id ) ; 
575563            writer . WriteProperty ( OpenApiConstants . DollarSchema ,  Schema ) ; 
576564            writer . WriteProperty ( OpenApiConstants . Comment ,  Comment ) ; 
577-             writer . WriteProperty ( OpenApiConstants . Vocabulary ,  Vocabulary ) ; 
578-             writer . WriteOptionalMap ( OpenApiConstants . Defs ,  Definitions ,  ( w ,  s )  =>  s . SerializeAsV3 ( w ) ) ; 
565+             writer . WriteOptionalMap ( OpenApiConstants . Vocabulary ,  Vocabulary ,   ( w ,   s )   =>   w . WriteValue ( s ) ) ; 
566+             writer . WriteOptionalMap ( OpenApiConstants . Defs ,  Definitions ,  ( w ,  s )  =>  s . SerializeAsV31 ( w ) ) ; 
579567            writer . WriteProperty ( OpenApiConstants . DynamicRef ,  DynamicRef ) ; 
580568            writer . WriteProperty ( OpenApiConstants . DynamicAnchor ,  DynamicAnchor ) ; 
581-             writer . WriteProperty ( OpenApiConstants . RecursiveAnchor ,  RecursiveAnchor ) ; 
582-             writer . WriteProperty ( OpenApiConstants . RecursiveRef ,  RecursiveRef ) ; 
583569            writer . WriteProperty ( OpenApiConstants . V31ExclusiveMaximum ,  V31ExclusiveMaximum ) ; 
584570            writer . WriteProperty ( OpenApiConstants . V31ExclusiveMinimum ,  V31ExclusiveMinimum ) ;             
585571            writer . WriteProperty ( OpenApiConstants . UnevaluatedProperties ,  UnevaluatedProperties ,  false ) ; 
0 commit comments