Open AdrienLemaire opened 4 years ago
Following this apollo-tooling comment, I copied the following snippet found in test/helpers/configTestHelpers.js into my schema.graphql file:
directive @cypher(statement: String) on FIELD_DEFINITION
directive @relation(name: String, direction: _RelationDirections, from: String, to: String) on FIELD_DEFINITION | OBJECT
enum _RelationDirections {
IN
OUT
}
Now, I get types generated in __generated__
directories
$ npm run codegen
> project-client@2.0.1 codegen /home/dori/Projects/Work/project-v2/platform_v2/client
> apollo client:codegen --target typescript --watch
✔ Loading Apollo Project
✔ Generating query files with 'typescript' target - wrote 3 files
Press any key to stop.
[GraphQL error]: 406: Not Acceptable
Error: 406: Not Acceptable
at ApolloEngineClient.loadSchemaTagsAndFieldStats (/home/dori/Projects/Work/project-v2/platform_v2/client/node_modules/apollo-language-server/lib/engine/index.js:181:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async /home/dori/Projects/Work/project-v2/platform_v2/client/node_modules/apollo-language-server/lib/project/client.js:200:52
at async OclifLoadingHandler.handle (/home/dori/Projects/Work/project-v2/platform_v2/client/node_modules/apollo/lib/OclifLoadingHandler.js:9:25)
at async GraphQLClientProject.loadEngineData (/home/dori/Projects/Work/project-v2/platform_v2/client/node_modules/apollo-language-server/lib/project/client.js:198:9)
$ git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: ../api_server/src/schema.graphql
Untracked files:
(use "git add <file>..." to include in what will be committed)
__generated__/
src/__generated__/
src/components/__generated__/
I don't understand what that last error is about though.
For anyone trying to autogenerate typescript types with neo4j-graphql, check out https://graphql-code-generator.com rather than apollo codegen. I just followed the below guide and was able to generate types for my neo4j-graphql project.
https://www.ouestware.com/2020/09/08/GRAND-stack-one-schema-to-rule-them-all/
Looking at #290, it seems like
apollo client:codegen
should work with grandstack , but I'm getting the following error whenever I try to generate my types:Here is the schema.graphql used by my apollo server:
related code in API server:
apollo.config.js on server
apollo.config.js on client
Version apollo client
Also using
"@apollo/client": "3.0.0-beta.39",
for the client app, but I guess it doesn't matter for this issue. API server apollo version:"apollo-server": "2.12.0",