Graphql-tools: mergeSchema - __typename isn't added when subschema doesn't know it is an interface

Created on 2 Nov 2017  路  4Comments  路  Source: ardatan/graphql-tools

If the field resolved by mergeSchema resolvers returns interface and the delegated field is not, __typename is not injected in it.

Example (first query)

bug schema stitching

Most helpful comment

An updates on the status of this issue?

All 4 comments

An updates on the status of this issue?

Same here... 馃槩 How to solve it?

In my case there were problems with upstream server introspection query results.

                {
                    "kind": "INTERFACE",
                    "name": "Vehicle",
                    "description": "",
                    "fields": [
                        {
                            "name": "maxSpeed",
                            "description": "",
                            "args": [],
                            "type": {
                                "kind": "SCALAR",
                                "name": "Int",
                                "ofType": null
                            },
                            "isDeprecated": false,
                            "deprecationReason": null
                        }
                    ],
                    "inputFields": null,
                    "interfaces": null,
                    "enumValues": null,
                    "possibleTypes": [
                        {
                            "kind": "OBJECT",
                            "name": "Airplane",
                            "ofType": null
                        },
                        {
                            "kind": "OBJECT",
                            "name": "Car",
                            "ofType": nulls introspection query results.

                        }
                    ]
                },

Is field possibleTypes is null schema stitching does not work correctly with GraphQl interfaces.

Since one of the upstream backends is written with PHP I have found solution in documentation:

Related issue: https://github.com/apollographql/graphql-tools/issues/441

This stale issue is likely resolved by ExpandAbstractTypes transform.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

udisun picture udisun  路  3Comments

MehrdadKhnzd picture MehrdadKhnzd  路  3Comments

benjaminhon picture benjaminhon  路  3Comments

adamkl picture adamkl  路  3Comments

alfaproject picture alfaproject  路  4Comments