Lancetnik/Propan

ValidationError body field required

Closed this issue · 1 comments

An error occurred when upgrading from version 0.1.3.7 to 0.1.3.8.
ValidationError(model='my_handler', errors=[{'loc': ('body',), 'msg': 'field required', 'type': 'value_error.missing'}])

The error appears only with additional arguments in the handler function:

class Message(BaseModel):
    data: str

async def my_handler(body: Message, logger: Logger, settings: Settings = Context()):
    ...

And it does not occur if additional arguments are removed:

class Message(BaseModel):
    data: str

async def my_handler(body: Message):
    ...

The data type of the body does not affect the error, only the additional arguments of the function affect.
When rolling back to 0.1.3.7, the error stops reproducing.

I couldn't figure out what the problem was, since I'm not very immersed in the source code of the project. Thank you in advance for the answer.

@shlyamster thanks for using Propan and for your feedback! This bug was in fast-depends==2.0.2 version. So, you can use propan==0.1.3.8 or the last 0.1.3.9 with updated fast-depends