@delegates and @validate_call

If using

from pydantic import BaseModel, Field, validate_call
from fastcore.all import delegates

you have a function like

@validate_call
@delegates(f_called_inside)
def f_outside( ...,  **kwargs):
   ....

You may experience

... /pydantic/_internal/_validate_call.py:96, in ValidateCallWrapper.__call__(self, *args, **kwargs)

ValidationError: 2 validation errors for 

  Unexpected keyword argument [type=unexpected_keyword_argument, input_value=
    For further information visit https://errors.pydantic.dev/2.8/v/unexpected_keyword_argument

To avoid it, keep the **kwargs in the function definition by doing


@validate_call
@delegates(f_called_inside,keep=True)
def f_outside( ...,  **kwargs):
   ....

Alternatively you can invert the order of decorators. In this case the keep doesn’t change the result.

@delegates(f_called_inside,keep=True)
@validate_call
def f_outside( ...,  **kwargs):
   ....

or

@delegates(f_called_inside)
@validate_call
def f_outside( ...,  **kwargs):
   ....

I would like to know if any of these orders is wrong and/or not recommended.