-
Notifications
You must be signed in to change notification settings - Fork 201
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
Some JSON schemas cannot be expressed using Wing's json structs #2023
Comments
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Hi, This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Hi, This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Related: #3686 |
I tried this:
Wing's json structs (structs that can be serialized into JSON) are designed to be able to express cloud data shapes. As such, they are closely related to JSON Schemas.
Currently, Wing's type system doesn't have the ability to express everything that JSON schemas can express.
For example, the
oneOf
andanyOf
annotations can be used in JSON schemas to denote a union of possible types for a field, and this is currently not supported by the Wing type-system.Consider the following JSON schema:
I expected this:
I expect to be able to model this in Winglang somehow.
Instead, this happened:
I don't have a way to model this.
Is there a workaround?
We can start by using
Json
to model these schemas without strong typing.If that's suitable for my use case, I could just choose the first schema from the
anyOf
oroneOf
arrays and use that, but this doesn't really address the underlying issue.Component:
Language Design
Wing Version:
No response
Node.js Version:
No response
Platform(s):
No response
Anything else?
No response
Community Note
The text was updated successfully, but these errors were encountered: