-
Notifications
You must be signed in to change notification settings - Fork 391
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
Support generics #59
Comments
This is an interesting idea. I guess there are 2 parts:
|
Explicit is always better than implicit, but for first part I was assuming that it will infer types from title |
Inferring from title is too unstructured for my taste, and makes parts 1 and 2 above asymmetrical. Also, someone might for some reason have "IArg<T, R>" as a title, but not intend it as a generic interface. I'd go for explicit all the way through (options 1b and 2a). What do you think? |
maybe you are right |
@bcherny Yes, you are right explicit is better here too |
Any update on this new feature would be great to have and also add conditionals types |
@joseSantacruz What’s your use case for generic and conditional types in JSON-Schema? |
My use case (and the reason for my fork) is opaque containers. For example, our application has a lot of encrypted data, so our API frequently sends something of type |
That's necessary for container-contracts: events, commands, etc. We faced same problem with protobuffs and there is only workaround to use something like Any, but I don't have an idea how to do same with json-schema. |
a rather simple way of allowing use of generics is to patch the regex in toSafeString() in src/utils.ts to also allow "<" and ">" being part of TS identifier and then use e.g. title: Typename<Generic> |
Can you support generics? Like generating from this:
to this:
The text was updated successfully, but these errors were encountered: