pydantic-to-typescript
pydantic-to-typescript copied to clipboard
Add --to-camel option to convert from snake_case to camelCase
What this PR does
- Adds an option flag
--to-camel, which triggers model property names to be converted fromsnake_casetocamelCasein the resulting TS interfaces - Fixes
cli/script.pyto fail gracefully when no Pydantic models are found, resulting in an empty .ts file. This could instead just create nothing out output a warning to stdout.
Why this is necessary
We would like our resulting TS interfaces to follow the camel case convention when the model is defined via TS, and snake case when in Python
Also, the CLI hard fails when no Pydantic models are found.