pydantic-to-typescript
pydantic-to-typescript copied to clipboard
Automatically generate TypeScript types for all Pydantic models in a directory
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 have a directory (e.g., my_project/models/) containing many Python modules, each with multiple Pydantic models. I’d like to know if there’s a way to automatically generate TypeScript types for all Pydantic models in a directory or package, without manually specifying each module.
Does pydantic2ts support this functionality natively? Or would I need to implement this myself, e.g., by dynamically importing all models in the directory?