INNER CODE UNIT · Python
generate_typescript_defs
phillipdupuis/pydantic-to-typescript · pydantic2ts/cli/script.py:299
def generate_typescript_defs(
module: str,
output: str,
exclude: Tuple[str, ...] = (),
json2ts_cmd: str = "json2ts",
) -> None:
"""
Convert the pydantic models in a python module into typescript interfaces.
:param module: python module containing pydantic model definitions.
example: my_project.api.schemas
:param output: file that the typescript definitions will be written to
:param exclude: optional, a tuple of names for pydantic models which
should be omitted from the typescript output.
:param json2ts_cmd: optional, the command that will execute json2ts.
Provide this if the executable is not discoverable
or if it's locally installed (ex: 'yarn json2ts').
"""