Skip to content
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

Invalid schema checks #141

Closed
simPod opened this issue Mar 28, 2018 · 2 comments
Closed

Invalid schema checks #141

simPod opened this issue Mar 28, 2018 · 2 comments

Comments

@simPod
Copy link

simPod commented Mar 28, 2018

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

@jimkyndemeyer
Copy link
Collaborator

jimkyndemeyer commented Jun 19, 2018

The 2.0 alpha follows the latest GraphQL language draft spec as of June 2018.

See 2.0.0-alpha-2 if you'd like to try it and help test it.

@simPod
Copy link
Author

simPod commented Jul 5, 2018

Thanks will do. Already reported an issue ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants