@@ -53,8 +53,6 @@ pub enum TypedValue {
5353 // 53-bit precision for integers, integers are represented as tagged
5454 // strings, with a custom serializer and deserializer.
5555 // TAGGED TYPES:
56- Set ( Set ) ,
57- Dictionary ( Dictionary ) ,
5856 Int (
5957 #[ serde( serialize_with = "serialize_i64" , deserialize_with = "deserialize_i64" ) ]
6058 // #[schemars(with = "String", regex(pattern = r"^\d+$"))]
@@ -67,6 +65,10 @@ pub enum TypedValue {
6765 PodId ( PodId ) ,
6866 // UNTAGGED TYPES:
6967 #[ serde( untagged) ]
68+ Set ( Set ) ,
69+ #[ serde( untagged) ]
70+ Dictionary ( Dictionary ) ,
71+ #[ serde( untagged) ]
7072 Array ( Array ) ,
7173 #[ serde( untagged) ]
7274 String ( String ) ,
@@ -230,18 +232,6 @@ impl JsonSchema for TypedValue {
230232 fn json_schema ( gen : & mut schemars:: gen:: SchemaGenerator ) -> schemars:: schema:: Schema {
231233 use schemars:: schema:: { InstanceType , Schema , SchemaObject , SingleOrVec } ;
232234
233- let dictionary_schema = schemars:: schema:: SchemaObject {
234- instance_type : Some ( SingleOrVec :: Single ( Box :: new ( InstanceType :: Object ) ) ) ,
235- object : Some ( Box :: new ( schemars:: schema:: ObjectValidation {
236- properties : [ ( "Dictionary" . to_string ( ) , gen. subschema_for :: < Dictionary > ( ) ) ]
237- . into_iter ( )
238- . collect ( ) ,
239- required : [ "Dictionary" . to_string ( ) ] . into_iter ( ) . collect ( ) ,
240- ..Default :: default ( )
241- } ) ) ,
242- ..Default :: default ( )
243- } ;
244-
245235 // Int is serialized/deserialized as a tagged string
246236 let int_schema = schemars:: schema:: SchemaObject {
247237 instance_type : Some ( SingleOrVec :: Single ( Box :: new ( InstanceType :: Object ) ) ) ,
@@ -293,17 +283,18 @@ impl JsonSchema for TypedValue {
293283 // This is the part that Schemars can't generate automatically:
294284 let untagged_array_schema = gen. subschema_for :: < Array > ( ) ;
295285 let untagged_set_schema = gen. subschema_for :: < Set > ( ) ;
286+ let untagged_dictionary_schema = gen. subschema_for :: < Dictionary > ( ) ;
296287 let untagged_string_schema = gen. subschema_for :: < String > ( ) ;
297288 let untagged_bool_schema = gen. subschema_for :: < bool > ( ) ;
298289
299290 Schema :: Object ( SchemaObject {
300291 subschemas : Some ( Box :: new ( schemars:: schema:: SubschemaValidation {
301292 any_of : Some ( vec ! [
302- Schema :: Object ( dictionary_schema) ,
303293 Schema :: Object ( int_schema) ,
304294 Schema :: Object ( raw_schema) ,
305295 Schema :: Object ( public_key_schema) ,
306296 untagged_array_schema,
297+ untagged_dictionary_schema,
307298 untagged_string_schema,
308299 untagged_set_schema,
309300 untagged_bool_schema,
0 commit comments