tortoise / tortoise/tortoise-orm
model_config Parameter in pydantic_model_creator Not Effective in Sub Models
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
When using pydantic_model_creator to create schemas, I want to set the json_encoders in the schema via the model_config parameter. Additionally, I want the same json_encoders to be used in sub models. However, the json_encoders are not effective in the sub models.
I noticed that in _pydantic_recursion_protector, the model_config is not passed to the sub models. How can I ensure that the json_encoders in model_config are applied to sub models?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting _pydantic_recursion_protector, which the report identifies as the point where model_config is not passed to sub models. Reproduce the issue with nested schemas and json_encoders, then verify that the configured encoders are applied consistently to both the top-level schema and its sub models.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100