@@ -752,8 +752,17 @@ impl FieldType {
752
752
FieldType :: Map { value_ty } => {
753
753
format ! ( "Map<String,{}>" , value_ty. to_java_typename( ) ) . into ( )
754
754
}
755
- FieldType :: SchemaRef ( name) => name. clone ( ) . into ( ) ,
756
- FieldType :: StringConst ( _) => "String" . into ( ) ,
755
+ FieldType :: SchemaRef ( name) => {
756
+ // TODO(mendy): this corresponds to a `#[serde(untagged)]` enum `svix_server::v1::endpoints::background_tasks::Data`
757
+ // we should change this server side
758
+ if name == "Data" {
759
+ "Object" . into ( )
760
+ } else {
761
+ name. clone ( ) . into ( )
762
+ }
763
+ }
764
+ // backwards compat
765
+ FieldType :: StringConst ( _) => "TypeEnum" . into ( ) ,
757
766
}
758
767
}
759
768
@@ -841,6 +850,10 @@ impl minijinja::value::Object for FieldType {
841
850
ensure_no_args ( args, "is_json_object" ) ?;
842
851
Ok ( matches ! ( * * self , Self :: JsonObject ) . into ( ) )
843
852
}
853
+ "is_string_const" => {
854
+ ensure_no_args ( args, "is_string_const" ) ?;
855
+ Ok ( matches ! ( * * self , Self :: StringConst ( _) ) . into ( ) )
856
+ }
844
857
845
858
// Returns the inner type of a list or set
846
859
"inner_type" => {
@@ -866,6 +879,14 @@ impl minijinja::value::Object for FieldType {
866
879
} ;
867
880
Ok ( ty. into ( ) )
868
881
}
882
+ "string_const_val" => {
883
+ ensure_no_args ( args, "value_type" ) ?;
884
+ let val = match & * * self {
885
+ Self :: StringConst ( val) => Some ( minijinja:: Value :: from_safe_string ( val. clone ( ) ) ) ,
886
+ _ => None ,
887
+ } ;
888
+ Ok ( val. into ( ) )
889
+ }
869
890
_ => Err ( minijinja:: Error :: from ( minijinja:: ErrorKind :: UnknownMethod ) ) ,
870
891
}
871
892
}
0 commit comments