-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
No standard way to define schema for key in "Record-like" objects #1448
Comments
I'm not entirely following what you're asking for here, but you might be interested in the
|
Yeah, it is! Thanks! Sorry for the panic, never seen it before (think because |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original issue:
sinclairzx81/typebox#601
I don't like when Record-like objects used in JSON-related things (API, Generators, Validators), basically, I think it because I have "childhood trauma" about JSONSchema that can't strictly declare left side of it.
Args:
key
(likePositiveInt
,format:'phone'
& etc.)title
,description
& etc.)jsonschema -> ts
(and I think others) generators can't properly generatekey
type, only indirectlyadditionalProperties: true
$ref
thatkey
Input Examples:
I don't see a clear way for now, but for the start:
Variant 1:
Variant 2:
Variant 3:
Refs:
https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type
https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures
The text was updated successfully, but these errors were encountered: