You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The type of an object implementing an interface cannot be resolved, although a resolver has been defined and added to the .meshrc.yaml. Mesh then quits with an error from graphql-jit/execution.ts stating Could not resolve the object type in possible types of Fruit for the value: {"name":"Apple","type":"tree"}, which is because Fruit.resolveType is undefined, so for some reason the defined TypeResolver is not applied.
To Reproduce
Steps to reproduce the behavior:
I have an OpenAPI schema returning an array of abstract objects (Fruit). Mesh generates:
Fruits {
fruits: [JSON]
}
So Mesh is not capable of producing a proper schema for abstract return types. However I then tried to replace the field Fruits.fruit with a proper representation (.meshrc.yaml).
- replaceField:
typeDefs: | interface Fruit { name: String! } type FruitsInt { fruits: [Fruit] } type Apple implements Fruit { name: String! type: String }replacements:
- from:
type: Fruitsfield: fruitsto:
type: FruitsIntfield: fruits
I also added an additional resolver resolvers.ts to resolve the type of Fruit.
Expected behavior
The defined resolver is being applied properly to the GraphQLInterfaceType instance and consequently the type resolution works as intended.
Environment:
OS: macOSX 12.3.1
@graphql-mesh/cli: "^0.68.3"
@graphql-mesh/json-schema: "^0.28.3"
@graphql-mesh/openapi: "^0.24.13"
@graphql-mesh/transform-replace-field: "0.3.46"
graphql: "^16.3.0"
NodeJS: v17.9.0
The text was updated successfully, but these errors were encountered:
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
The type of an object implementing an interface cannot be resolved, although a resolver has been defined and added to the
.meshrc.yaml
. Mesh then quits with an error fromgraphql-jit/execution.ts
statingCould not resolve the object type in possible types of Fruit for the value: {"name":"Apple","type":"tree"}
, which is becauseFruit.resolveType
isundefined
, so for some reason the defined TypeResolver is not applied.To Reproduce
Steps to reproduce the behavior:
I have an OpenAPI schema returning an array of abstract objects (Fruit). Mesh generates:
So Mesh is not capable of producing a proper schema for abstract return types. However I then tried to replace the field
Fruits.fruit
with a proper representation (.meshrc.yaml
).I also added an additional resolver
resolvers.ts
to resolve the type of Fruit.Expected behavior
The defined resolver is being applied properly to the GraphQLInterfaceType instance and consequently the type resolution works as intended.
Environment:
@graphql-mesh/cli
: "^0.68.3"@graphql-mesh/json-schema
: "^0.28.3"@graphql-mesh/openapi
: "^0.24.13"@graphql-mesh/transform-replace-field
: "0.3.46"graphql
: "^16.3.0"The text was updated successfully, but these errors were encountered: