pydantic-to-typescript icon indicating copy to clipboard operation
pydantic-to-typescript copied to clipboard

CLI Tool for converting pydantic models into typescript definitions

Results 39 pydantic-to-typescript issues
Sort by recently updated
recently updated
newest added

Hello. Thanks for this package, it makes our lives a lot easier in keeping definitions consistent across BE and FE repos. One challenge we've been been facing is with loss...

I've tried this by defining a single module with multiple schema py's on OSX and Linux and am getting an error: line 111, in remove_master_model_from_output new_lines = lines[:start] + lines[(end...

Resolves #2. Allows you to select whether you want the generated model to use the public-facing model property (by_alias=False, default) or the aliased field name (by_alias=True).

I would like to define a different banner comment via CLI arguments. The current one with `"just update the pydantic models and then re-run the script"` works well as a...

json2ts started failing on my machine due to some hard to reproduce issue related running x86 binaries on an m1 mac. However since the output file was still there (it...

## To reproduce: ```python #types.py from typing import List, Tuple from pydantic import BaseModel class Model(BaseModel): tuple: Tuple[str, int] list_of_tuples: List[Tuple[str, int]] ``` ``` pydantic2ts --module ./types.py --output ./types.ts ```...

With new installations, it seems that if you convert a generic model the resulting .ts definitions have this docstring above all models subclassing pydantic's GenericModel: ``` /** * Abstract base...

Hi! First of all, many thanks for providing this useful tool! I'm trying to get it running, but there are two issues I'm stuck with. First is the same as...

From Python 3.10 onwards `Type | None` [is supposed to be preferred over](https://user-images.githubusercontent.com/24777308/193001159-391acac1-37c7-4ed8-8e90-958edd348043.png) `Optional[Type]` [pydantic's documentation gives a Python 3.10+ code example](https://pydantic-docs.helpmanual.io/usage/models/#required-optional-fields) for a Required field which is also "Optional"...