pydantic-to-typescript
pydantic-to-typescript copied to clipboard
CLI Tool for converting pydantic models into typescript definitions
Pydantic 2.0 just came out. This PR uses their new syntax. One difference is that Optional parameters now output property: | null instead of property?. All the tests passed locally.
Hi @phillipdupuis, after switching to Pydantic V2 in one of my projects, this library stopped working. To make sure that my changes are compatible with both, Pydantic V1 and V2,...
- Use ducktyping for Generic Models - use `model_config` instead of `Config` attr
This library seems to be actively used and filling a somewhat unique niche, but it seems you're busy. Have you considered adding another maintainer to the project, or maybe completely...
Otherwise the program will happily try to write to a file called `None`.
Using this script in my project with Pydantic 2.3 (likely all 2.x versions, just tried 2.2 also with same result) with example provided in readme leads to an AttributeError: ```...
Enums which are part of a pydantic model are translated to a type, losing relevant and useful information that could be kept if they were translated to enums in typescript...
I am seeing an issue when generating typescript types from pydantic models that consist of a custom root dict field, like this: **Pydantic model**: ```python class CustomModel(BaseModel): __root__: dict[str, int]...
If I define a property using a Literal with a default value, it shows as optional in typescript. This *is* similar to #28 but, I think it should be treated...
Hi and thank you for this package! I would like to report a bug with version 1.0.10 and Python version 3.10. Assume we have this Python file: ```python # test.py...