hello I am having this problem when i receive a put request in my app:
Here is my router:
@product_router.put("/{id}", response_model=ProductUpdateResponseSchema)
@authenticated(validate=[Validation.IS_ADMIN])
def update_product(id: str, payload: ProductUpdateSchema):
"""Updates a product."""
product = ProductService.update(id, payload.dict(exclude_none=True))
return product
and here my schema:
class ProductUpdateSchema(BaseSchema):
"""Product Update Schema."""
name: Optional[str]
description: Optional[List[str]]
min_amount_value: Optional[float] = Field(alias="amount_min")
max_amount_value: Optional[float] = Field(alias="amount_max")
amount_help: Optional[str]
information: Optional[str]
rate_without_iva: Optional[float] = Field(alias="rate")
iva_rate: Optional[float] = Field(alias="tax_rate")
rate_help: Optional[str]
line_group: Optional[str]
restricted: Optional[str]
active: Optional[bool]
grace_period: Optional[int]
requires_supplier: Optional[bool]
requires_amount: Optional[bool]
@root_validator
def format(cls, values):
if restricted := values.get('restricted'):
values['restricted'] = LineCreditLegalPerson[restricted].value
else:
values['restricted'] = None
return values
i have tried receiving the payload as a json type and then parsing it with the schema and also i have tried with jsonable_encoder(payload), but i have still the same issue