@@ -245,7 +245,7 @@ impl<T: SourceFactoryBase> SourceFactory for T {
245245 EnrichedValueType ,
246246 BoxFuture < ' static , Result < Box < dyn SourceExecutor > > > ,
247247 ) > {
248- let spec: T :: Spec = serde_json :: from_value ( spec)
248+ let spec: T :: Spec = utils :: deser :: from_json_value ( spec)
249249 . with_context ( || format ! ( "Failed in parsing spec for source `{source_name}`" ) ) ?;
250250 let output_schema = self . get_output_schema ( & spec, & context) . await ?;
251251 let source_name = source_name. to_string ( ) ;
@@ -324,7 +324,7 @@ impl<T: SimpleFunctionFactoryBase> SimpleFunctionFactory for T {
324324 EnrichedValueType ,
325325 BoxFuture < ' static , Result < Box < dyn SimpleFunctionExecutor > > > ,
326326 ) > {
327- let spec: T :: Spec = serde_json :: from_value ( spec)
327+ let spec: T :: Spec = utils :: deser :: from_json_value ( spec)
328328 . with_context ( || format ! ( "Failed in parsing spec for function `{}`" , self . name( ) ) ) ?;
329329 let mut nonnull_args_idx = vec ! [ ] ;
330330 let mut may_nullify_output = false ;
@@ -399,7 +399,7 @@ pub trait TargetFactoryBase: TargetFactory + Send + Sync + 'static {
399399 /// Deserialize the setup key from a JSON value.
400400 /// You can override this method to provide a custom deserialization logic, e.g. to perform backward compatible deserialization.
401401 fn deserialize_setup_key ( key : serde_json:: Value ) -> Result < Self :: SetupKey > {
402- Ok ( serde_json :: from_value ( key) ?)
402+ Ok ( utils :: deser :: from_json_value ( key) ?)
403403 }
404404
405405 /// Will not be called if it's setup by user.
@@ -468,7 +468,7 @@ impl<T: TargetFactoryBase> TargetFactory for T {
468468 . into_iter ( )
469469 . map ( |d| {
470470 anyhow:: Ok ( TypedExportDataCollectionSpec {
471- spec : serde_json :: from_value ( d. spec ) . with_context ( || {
471+ spec : utils :: deser :: from_json_value ( d. spec ) . with_context ( || {
472472 format ! ( "Failed in parsing spec for target `{}`" , d. name)
473473 } ) ?,
474474 name : d. name ,
@@ -480,7 +480,7 @@ impl<T: TargetFactoryBase> TargetFactory for T {
480480 . collect :: < Result < Vec < _ > > > ( ) ?,
481481 declarations
482482 . into_iter ( )
483- . map ( |d| anyhow:: Ok ( serde_json :: from_value ( d) ?) )
483+ . map ( |d| anyhow:: Ok ( utils :: deser :: from_json_value ( d) ?) )
484484 . collect :: < Result < Vec < _ > > > ( ) ?,
485485 context,
486486 )
@@ -515,7 +515,7 @@ impl<T: TargetFactoryBase> TargetFactory for T {
515515 ) -> Result < Box < dyn setup:: ResourceSetupChange > > {
516516 let key: T :: SetupKey = Self :: deserialize_setup_key ( key. clone ( ) ) ?;
517517 let desired_state: Option < T :: SetupState > = desired_state
518- . map ( |v| serde_json :: from_value ( v. clone ( ) ) )
518+ . map ( |v| utils :: deser :: from_json_value ( v. clone ( ) ) )
519519 . transpose ( ) ?;
520520 let existing_states = from_json_combined_state ( existing_states) ?;
521521 let setup_change = TargetFactoryBase :: diff_setup_states (
@@ -546,8 +546,8 @@ impl<T: TargetFactoryBase> TargetFactory for T {
546546 ) -> Result < SetupStateCompatibility > {
547547 let result = TargetFactoryBase :: check_state_compatibility (
548548 self ,
549- & serde_json :: from_value ( desired_state. clone ( ) ) ?,
550- & serde_json :: from_value ( existing_state. clone ( ) ) ?,
549+ & utils :: deser :: from_json_value ( desired_state. clone ( ) ) ?,
550+ & utils :: deser :: from_json_value ( existing_state. clone ( ) ) ?,
551551 ) ?;
552552 Ok ( result)
553553 }
@@ -600,7 +600,7 @@ impl<T: TargetFactoryBase> TargetFactory for T {
600600 . into_iter ( )
601601 . map ( |item| -> anyhow:: Result < _ > {
602602 Ok ( TypedResourceSetupChangeItem {
603- key : serde_json :: from_value ( item. key . clone ( ) ) ?,
603+ key : utils :: deser :: from_json_value ( item. key . clone ( ) ) ?,
604604 setup_change : ( item. setup_change as & dyn Any )
605605 . downcast_ref :: < T :: SetupChange > ( )
606606 . ok_or_else ( invariance_violation) ?,
@@ -618,15 +618,15 @@ fn from_json_combined_state<T: Debug + Clone + Serialize + DeserializeOwned>(
618618 Ok ( setup:: CombinedState {
619619 current : existing_states
620620 . current
621- . map ( |v| serde_json :: from_value ( v) )
621+ . map ( |v| utils :: deser :: from_json_value ( v) )
622622 . transpose ( ) ?,
623623 staging : existing_states
624624 . staging
625625 . into_iter ( )
626626 . map ( |v| {
627627 anyhow:: Ok ( match v {
628628 setup:: StateChange :: Upsert ( v) => {
629- setup:: StateChange :: Upsert ( serde_json :: from_value ( v) ?)
629+ setup:: StateChange :: Upsert ( utils :: deser :: from_json_value ( v) ?)
630630 }
631631 setup:: StateChange :: Delete => setup:: StateChange :: Delete ,
632632 } )
0 commit comments