I have a problem with WebStorm syntax highlighting. I created valid GraphQL query which works on localhost app but WebStorm says that
unknown field “familyMembers” on object type “Query”
and highlights the whole query in red.
I am really confused but maybe I should change something inside apollo.config.js
– if yes please tell me what.
HelloWorld.vue
JavaScript
x
20
20
1
<script>
2
import gql from 'graphql-tag';
3
export default {
4
apollo: {
5
familyMembers: gql `
6
query familyMembers {
7
familyMembers {
8
id
9
firstName
10
lastName
11
}
12
}`
13
},
14
name: 'HelloWorld',
15
props: {
16
msg: String
17
}
18
}
19
</script>
20
apollo.config.js
JavaScript
1
15
15
1
module.exports = {
2
client: {
3
service: {
4
name: 'vav',
5
// URL to the GraphQL API
6
url: 'http://localhost:4000',
7
},
8
// Files processed by the extension
9
includes: [
10
'src/**/*.vue',
11
'src/**/*.js',
12
],
13
},
14
};
15
Some screenshots:
Advertisement
Answer
Ok so I figured out how to do this you do not need apollo.config.js
you have to create .graphqlconfig in which you will declarate local schema path and endpoint url like that:
JavaScript
1
16
16
1
{
2
"name": "Untitled GraphQL Schema",
3
"schemaPath": "schema.graphql",
4
"extensions": {
5
"endpoints": {
6
"Default GraphQL Endpoint": {
7
"url": "http://localhost:4000",
8
"headers": {
9
"user-agent": "JS GraphQL"
10
},
11
"introspect": false
12
}
13
}
14
}
15
}
16