Open tspanos opened 2 years ago
Hi @tspanos
for now you can use the following workaround - set Default value for each attr:
class CarSchemaIn(ModelSchema):
manufacturer: Optional[ManufacturerSchemaIn] = None
manufacturer_id: Optional[int]= None
drivers: Optional[List[DriverSchemaIn]] = []
drivers_ids: Optional[List[int]] = []
This workaround only works if the users sends nothing for the given key? It doesn't work if the client sends null at least. And the generated docs are of course still wrong.
Describe the bug Assume the following Model and ModelSchema:
django-ninja does not obey the
Optional
type and generates a schema where the manually declared optional fields are required.Versions: