phillipdupuis / pydantic-to-typescript

CLI Tool for converting pydantic models into typescript definitions
MIT License
285 stars 48 forks source link

Add --readonly-interfaces option #31

Open bibermann opened 1 year ago

bibermann commented 1 year ago

This fixes #28 by providing a --readonly-interfaces option that prevents non-optional fields with default values to become optional in the TypeScript interface.

--readonly-interfaces can be read as "create interfaces for data that is read by an API", i.e. the interface for data generated by pydantic (in contrast to data that gets deserialized by pydantic).

For more information, see README.md as well as tests/expected_results/optionals/README.md.