Skip to content

Invalid schema checks #141

@simPod

Description

@simPod

I'm having latest version of this plugin.

It fails to work and returns this when started:

Error creating client schema Error: Node fields must be an object with field names as keys or a function which returns such an object.
    at invariant (~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:39817:11)
    at defineFieldMap (~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:43198:27)
    at GraphQLInterfaceType.getFields (~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:43275:44)
    at ~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:44875:27
    at typeMapReducer (~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:44887:7)
    at typeMapReducer (~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:44855:12)
    at ~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:44885:22
    at Array.forEach (<anonymous>)
    at ~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:44876:29
    at typeMapReducer (~/Library/Application Support/IntelliJIdea2017.3/js-graphql-intellij-plugin/js-graphql-language-service.dist.js:44887:7)

I believe it is because I have defined interface with no fields in my schema.

When I comment this line

(0, _invariant2.default)(fieldNames.length > 0, type.name + ' fields must be an object with field names as keys or a ' + 'function which returns such an object.');

at js-graphql-language-service.dist.js:43198:27 it works properly

->

It proceeds to this line (44917) when it fails again

(0, _invariant2.default)((0, _typeComparators.isTypeSubTypeOf)(schema, objectField.type, ifaceField.type), iface.name + '.' + fieldName + ' expects type "' + String(ifaceField.type) + '" ' + 'but ' + (object.name + '.' + fieldName + ' provides type "' + String(objectField.type) + '".'));

This time it is because Type A has field of type B that implements interface C. It complains that the field of type A is not type C but type B.

Note: my schema works perfectly with GraphiQL. It works as well when I comment line 43198 and 44917

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions