1111from  .bindings .meta  import  (has_implicit_output ,
1212                            check_deferred_bindings_enabled ,
1313                            check_output_type_annotation ,
14-                             check_input_type_annotation )
14+                             check_input_type_annotation ,
15+                             validate_settlement_param )
1516from  .utils .constants  import  HTTP_TRIGGER 
1617from  .utils .typing_inspect  import  is_generic_type , get_origin , get_args   # type: ignore 
1718
@@ -33,6 +34,7 @@ class FunctionInfo(typing.NamedTuple):
3334    has_return : bool 
3435    is_http_func : bool 
3536    deferred_bindings_enabled : bool 
37+     settlement_client_arg : typing .Optional [str ]
3638
3739    input_types : typing .Mapping [str , ParamTypeInfo ]
3840    output_types : typing .Mapping [str , ParamTypeInfo ]
@@ -138,12 +140,20 @@ def validate_function_params(params: dict, bound_params: dict,
138140                                 protos ):
139141        logger .debug ("Params: %s, BoundParams: %s, Annotations: %s, FuncName: %s" ,
140142                     params , bound_params , annotations , func_name )
143+         settlement_client_arg  =  None 
141144        if  set (params ) -  set (bound_params ):
142-             raise  FunctionLoadError (
143-                 func_name ,
144-                 'Function parameter mismatch — the following trigger/input bindings ' 
145-                 'are declared in Python but missing from the ' 
146-                 'function decorator: '  +  repr (set (params ) -  set (bound_params )))
145+             # Check for settlement client support for the missing parameters 
146+             settlement_client_arg  =  validate_settlement_param (
147+                 params , bound_params , annotations )
148+             if  settlement_client_arg  is  not   None :
149+                 params .pop (settlement_client_arg )
150+             else :
151+                 # Not supported by settlement client, raise error for missing parameters 
152+                 raise  FunctionLoadError (
153+                     func_name ,
154+                     'the following parameters are declared in Python ' 
155+                     'but not in the function definition (function.json or ' 
156+                     f'function decorators):  { set (params ) -  set (bound_params )!r}  ' )
147157
148158        if  set (bound_params ) -  set (params ):
149159            raise  FunctionLoadError (
@@ -278,7 +288,8 @@ def validate_function_params(params: dict, bound_params: dict,
278288                output_types [param .name ] =  param_type_info 
279289            else :
280290                input_types [param .name ] =  param_type_info 
281-         return  input_types , output_types , fx_deferred_bindings_enabled 
291+         return  (input_types , output_types , fx_deferred_bindings_enabled ,
292+                 settlement_client_arg )
282293
283294    @staticmethod  
284295    def  get_function_return_type (annotations : dict , has_explicit_return : bool ,
@@ -330,6 +341,7 @@ def add_func_to_registry_and_return_funcinfo(
330341            has_explicit_return : bool ,
331342            has_implicit_return : bool ,
332343            deferred_bindings_enabled : bool ,
344+             settlement_client_arg : typing .Optional [str ],
333345            input_types : typing .Dict [str , ParamTypeInfo ],
334346            output_types : typing .Dict [str , ParamTypeInfo ],
335347            return_type : str ):
@@ -355,6 +367,7 @@ def add_func_to_registry_and_return_funcinfo(
355367            has_return = has_explicit_return  or  has_implicit_return ,
356368            is_http_func = is_http_func ,
357369            deferred_bindings_enabled = deferred_bindings_enabled ,
370+             settlement_client_arg = settlement_client_arg ,
358371            input_types = input_types ,
359372            output_types = output_types ,
360373            return_type = return_type ,
@@ -412,7 +425,8 @@ def add_indexed_function(self, function, protos):
412425                                                    func_name )
413426
414427        (input_types , output_types ,
415-          deferred_bindings_enabled ) =  self .validate_function_params (
428+          deferred_bindings_enabled ,
429+          settlement_client_arg ) =  self .validate_function_params (
416430            params ,
417431            bound_params ,
418432            annotations ,
@@ -431,5 +445,6 @@ def add_indexed_function(self, function, protos):
431445                func , func_name , function_id , func_dir ,
432446                requires_context , has_explicit_return ,
433447                has_implicit_return , deferred_bindings_enabled ,
448+                 settlement_client_arg ,
434449                input_types , output_types ,
435450                return_type )
0 commit comments