json-schema-to-typescript icon indicating copy to clipboard operation
json-schema-to-typescript copied to clipboard

add `readonly` option

Open albertnahas opened this issue 10 months ago • 1 comments

feat: add readonly option to prepend readonly to fields

This feature adds a new readonly option to json-schema-to-typescript, enabling users to prepend readonly to all fields in generated TypeScript interfaces.

Changes:

  • Added logic to prepend readonly to fields in generator.ts.
  • Updated the Options interface to include the new readonly flag.
  • Updated README to document the readonly option.

Testing:

  • Added test cases to validate the readonly option.
  • Ensured all existing tests pass to maintain backward compatibility.

Closes #627

albertnahas avatar Dec 10 '24 14:12 albertnahas