Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to prepend "readonly" to all fields #627

Open
Bluscream opened this issue Sep 2, 2024 · 1 comment · May be fixed by #647
Open

Add option to prepend "readonly" to all fields #627

Bluscream opened this issue Sep 2, 2024 · 1 comment · May be fixed by #647

Comments

@Bluscream
Copy link

Bluscream commented Sep 2, 2024

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>;
  }
...
@bcherny
Copy link
Owner

bcherny commented Sep 28, 2024

It would make sense to emit all types as readonly, gated behind a --readonly option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants