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

Add --to-camel option to convert from snake_case to camelCase

Open ryanjdillon opened this issue 2 years ago • 0 comments

What this PR does

  • Adds an option flag --to-camel, which triggers model property names to be converted from snake_case to camelCase in the resulting TS interfaces
  • Fixes cli/script.py to 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.

ryanjdillon avatar Feb 14 '23 10:02 ryanjdillon