Js-graphql-intellij-plugin: Add support for Framework-specific Schema directives, e.g. Prisma

Created on 4 Apr 2018  ·  6Comments  ·  Source: jimkyndemeyer/js-graphql-intellij-plugin

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

enhancement v2-alpha v2-architecture

Most helpful comment

@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.

All 6 comments

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.

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
Thank you!
So how to config it to get rid of the error in alpha-3?

@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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MichaelDeBoey picture MichaelDeBoey  ·  4Comments

MegaJSDeveloper picture MegaJSDeveloper  ·  3Comments

vjpr picture vjpr  ·  4Comments

idkjs picture idkjs  ·  3Comments

rlancer picture rlancer  ·  3Comments