pydantic-to-typescript
pydantic-to-typescript copied to clipboard
CLI Tool for converting pydantic models into typescript definitions
Resolves phillipdupuis/pydantic-to-typescript#60
## Description of problem Given a Pydantic model with Chinese attributes: ```python class TrialRecord(BaseModel): 學號: str ``` OR with a Chinese alias: ```python class TrialRecord(BaseModel): student_id: str = Field(alias="學號") ```...
* The current check would try to load that as a file and fail. * Pointing to the file itself (foo/__init__.py) doesn't work because then the _is_submodule check fails, because...
## Summary Fixes: #28 Adds an `--all-fields-required` option (defaults to `False`) that ensures no generated TypeScript interface fields are marked as optional (`fieldName?: ...`), even if they have default values...
The fix for an issue created and proposed by @abhinavdayal . I hit this when I tried to use this with django-ninja Schema models, which subclass BaseModel...
Even though I include --exclude ModelName, I still see that model in the output. This is true for imported modules in the file. ```python from abc import Xyz class PQR(BaseModel):...
When trying to export models with extra="allow" setting in the config, We get error: ``` AttributeError: type object 'Config' has no attribute 'extra' ``` In `cli/script.py` line 257 After modifying...
Hi, I’m currently using pydantic2ts to generate TypeScript types from my Pydantic models, and it works great when specifying a single module like: `pydantic2ts --module my_project.models.some_model --output ./types/some_model.ts` However, I...
Is there a way to support `datetime` / `date` to `Date` conversions? Currently, they are converted to `string`. - Python input: ```py from datetime import date class MyModel(BaseModel): start_date: date...