Skip to content

Add support for Framework-specific Schema directives, e.g. Prisma #144

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

Closed
pvm opened this issue Apr 4, 2018 · 6 comments
Closed

Add support for Framework-specific Schema directives, e.g. Prisma #144

pvm opened this issue Apr 4, 2018 · 6 comments
Labels

Comments

@pvm
Copy link

pvm commented Apr 4, 2018

Hi guys,

I have a error saying: "Unknown directive @unique", "Unknow directive @default". This directives are used on Prisma.

That's normal or is really a bug?

Thanks

Below is the image of the errors:
image

@jimkyndemeyer
Copy link
Collaborator

Hi Phil.

The plugin is showing this as an error since it has no way to determine the validity of the directives.

It usually determines which directives are available using a configured schema or introspection against an endpoint. But in this case, since you're working on defining your schema, it would have to know the built-in directives given the framework you're using.

I'll keep this issue around as a possible enhancement. For now it's a limitation in the plugin.

Best regards,
Jim.

@jimkyndemeyer jimkyndemeyer changed the title Error using prisma Add support for Framework-specific Schema directives, e.g. Prisma Apr 4, 2018
@jimkyndemeyer
Copy link
Collaborator

jimkyndemeyer commented Jun 19, 2018

The 2.0 alpha release allow you to declare framework-specific directives as you would any other directive.

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

Edit: Directives placed on the schema types and fields appear to be reported as invalid locations and don't show up in completions. Expect this to be fixed in an upcoming alpha.

@jimkyndemeyer
Copy link
Collaborator

@yaquawa
Copy link

yaquawa commented Aug 16, 2018

@jimkyndemeyer
Thank you!
So how to config it to get rid of the error in alpha-3?

@jimkyndemeyer
Copy link
Collaborator

jimkyndemeyer commented Aug 16, 2018

@yaquawa You declare your framework directives in a .graphql file that you place in your project, e.g.:

directive @myFrameworkDirective on OBJECT | FIELD_DEFINITION

See http://facebook.github.io/graphql/June2018/#sec-Type-System.Directives for reference. The plugin should provide completion for you.

@yaquawa
Copy link

yaquawa commented Aug 16, 2018

@jimkyndemeyer
Perfect! Thanks! 👍🏼
(I didn't even notice that they have a directive keyword…)

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

No branches or pull requests

3 participants