json-schema-to-typescript
json-schema-to-typescript copied to clipboard
Add option to prepend "readonly" to all fields
This would be nice to ensure i don't accidentally try playing with values from responses but create my own local copy instead
Example:
start "" json2ts -i "schemas/pietsmiet.de/*.schema.json" -o "src/responses/pietsmiet.de/" --inferStringEnumKeysFromValues true --readonly true
export interface PietsmietDEConfig {
readonly API: Record<string, Record<string, string>>;
readonly URLs: Record<string, string>;
readonly Limits: Record<string, number>;
readonly Orders: Record<string, string>;
readonly Platform: Record<string, string>;
readonly Stream: Record<string, string>;
}
...
It would make sense to emit all types as readonly, gated behind a --readonly option.