Closed
Description
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- 1. The issue provides a reproduction available on Github or CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure Mesh package versions under
package.json
matches yours.
- 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
@graphql-mesh/json-schema
doesn't handle oneOf
(and probably allOf
& anyOf
) JSON Schema's instruction correctly.
For the following instructions:
"shouldBeStringOrNumber": {
"oneOf": [
{ "type": "number" },
{ "type": "string" }
]
}
The generated output will look like:
type MyObject {
shouldBeStringOrNumber: query_myObject_shouldBeStringOrNumber!
}
union query_myObject_shouldBeStringOrNumber = Float_container | String_container
type Float_container {
Float: Float
}
type String_container {
String: String
}
Which is not the desired behavior. shouldBeStringOrNumber
should be String | Float
while it became an object
with either a prop String: String
or a prop Float: Float
To Reproduce
Steps to reproduce the behavior:
See this github reproduction or this codebox
Expected behavior
type MyObject {
shouldBeStringOrNumber: query_myObject_shouldBeStringOrNumber!
}
union query_myObject_shouldBeStringOrNumber = Float | String
Environment:
- OS: MacOS
@graphql-mesh/cli
: ^0.80.4@graphql-mesh/graphql
: ^0.32.4@graphql-mesh/json-schema
: ^0.35.38
Additional context
None
Metadata
Metadata
Assignees
Labels
No labels