Skip to content

Automatically generate TypeScript types for all Pydantic models in a directory #52

@Fernichter

Description

@Fernichter

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions