pydantic_model_creator won't expose any fields with fields.DateTime in the schema in the swagger docs.
Describe the bug I am working on a very simple FastAPI example as suggested by the official documentation here.
In the example you can see usage of DateTime Fields like
created_at = fields.DatetimeField(auto_now_add=True)
modified_at = fields.DatetimeField(auto_now=True)
The problem or bug i noticed is if i use DateField instead of DatetimeField then the schema for the post request to create a User shows up in the FastAPI swagger docs like so
But if i use a DatetimeField the schema shows up like this
I am aware when creating a pydantic model i can pass the argument of exclude_readonly=True and in the example from the docs that argument is there but this only omits the id of the model in the schema.
I don't understand why even though auto_now_add=True and auto_now=True is specified for the fields it still complains of missing 2 fields. The missing fields error or response shows up like this in the swagger docs.
To Reproduce
Create a basic FastAPI App with a main.py file and a models.py file and run the project with same content as the FastAPI example from the documentation
Expected behavior
Expected behavior is for the proper schema with created_at and modified_at to show up in the schema.
i found a workaround for this for now. If anyone find this helpful, please star my gist. https://gist.github.com/i701/d35ced6c0f7d1d495c7dc385d87179fb