[ ] Regression
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Running the following commands:
$ graphql get-schema --project database
$ graphql codegen --project database
generates no files
Those commands should generate the following files
src/prisma/prisma-types.graphql
src/prisma/prisma.binding.ts
Follow these instructions and you will encounter the error when running the commands I specified above.
I believe this happens due to updates in how the graphpql-cli
now works (as in it's changed since the docs were written maybe) as when you're installing the cli it mentions the following The 'apollo-codegen' command has been replaced with the more-powerful 'apollo' CLI
I'm honestly not sure the exact reasons though or how to make it work as I'm new to the graphql cli, but hopefully this gives you a bit to go on
So that following the documentation allows for a working project
Nest version: 5.1.0
For Tooling issues:
- Node version: 10.10.0
- Platform: Mac
- graphql-cli version: 2.16.7
I've just realised the mistake is actually that the .graphqlconfig.yml
is incorrectly formatted.
I'd be happy to submit a PR for it but is that in a separate repo?
cc @cschroeter
Also worth noting that the latest version of the prisma cli that's currently in beta will break the setup in these docs too as it ships with its own client etc
@covertbert While I wrote that recipe I've noticed that in the next release there is a new way to create a Prisma client. I'm happy to update as soon as 1.7 lands 馃挭
Regarding the formatting issue .. that is why I don't like yaml. Especially if you have to write yaml in another context e.g an Angular component .. well nevertheless I already created a PR
Yeah yml is horrible when it comes to formatting! Stupid indentation-based nesting!
Sounds good to me anyway, let me know if I can help in any way (I'll at least be able to test if your docs are easy to follow etc) 馃槃
@cschroeter while you're here (if you don't mind) I've managed to get a project up and running but I'm quite often getting errors of the following type when making resolvers:
Type 'import("prisma.binding").Player[]' is not assignable to type 'import("graphql.schema").Player[]'.
I think this is a problem with how the plugin is generating the schema file although I'm not certain as both of the files being referred to here are automatically generated.
Any help would be much appreciated!
prisma.binding.ts
already includes all the typings related to Prisma. I think the beste approach for now is to exclude prisma-types.graphql
while generating the graphql.schema.d.ts
.
When you say exclude prisma-types.graphql
what do you mean? It's only referenced in the graphql config like so schemaPath: src/prisma/prisma-types.graphql
and removing that doesn't fix the issue unfortunately because it needs a schema path
I guess @cschroeter meant that you should exclude prisma-types
from typePaths: ['./**/*.graphql']
Unfortunately that doesn't fix it. Maybe I'm just doing it wrong but I essentially just removed typePaths: ['./**/*.graphql']
because I don't have any other .graphql
files in the repo. The same error is thrown after removing this.
I'm a complete typescript/nest beginner tbh so the errors I'm getting are pretty hard to reason about. Apologies as I know this probably isn't the right place for this kind of discussion as it may be my own lack of knowledge rather and an actual issue with the plugin
I figured what you meant so in case anybody else sees this and wonders....
We shouldn't be importing types in our resolvers from the graphql.schema
file like this import { Player } from '../graphql.schema';
Instead they can be imported from the prisma.binding.ts
file like this import { Player } from '../prisma/prisma.binding';
Hey guys couple questions
how to remove prisma-types from typePaths:['./**/*.graphql']
?
how to expose only selected Prisma resolvers (inorder to implement Authguard)?
You can just put them in the directory which doesn't match './**/*.graphql'
glob pattern.
Thanks @kamilmysliwiec , I moved prisma folder out of src but prisma types still show up in the GQL playground. Is there any other workaround.
@arjitkhullar ./**/*.graphql
matches everything in your root folder (incl. node_modules). To restrict access change it to ./src/**/*.graphql
.
@cschroeter I guess we will have to update the docs again due to the #1129. Anyway, let's track this issue there
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I figured what you meant so in case anybody else sees this and wonders....
We shouldn't be importing types in our resolvers from the
graphql.schema
file like thisimport { Player } from '../graphql.schema';
Instead they can be imported from the
prisma.binding.ts
file like thisimport { Player } from '../prisma/prisma.binding';