Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Support directives hints for schema definitions #129

Merged
merged 2 commits into from
Mar 13, 2017
Merged

Support directives hints for schema definitions #129

merged 2 commits into from
Mar 13, 2017

Conversation

RomanHotsiy
Copy link
Contributor

@RomanHotsiy RomanHotsiy commented Mar 11, 2017

Add support for directives hints for schema definitions (schema shorthand notation)

image

@RomanHotsiy
Copy link
Contributor Author

@RomanHotsiy
Copy link
Contributor Author

@asiandrummer, I know you're working on graphql-language-service. Maybe you could comment

@asiandrummer
Copy link
Contributor

@RomanGotsiy thanks for the contribution - your changes look awesome!
You're correct that this change should be mirrored to graphql-language-service as one of the packages in that repo (graphql-language-service-interface to be exact) should serve as the source of truth, but we haven't done that migration yet. I can take care of this when we get the migration happening ;)

I'm going to merge this - again thanks for the contribution!

@RomanHotsiy
Copy link
Contributor Author

@asiandrummer awesome!

Btw wanted to ask about graphql-language-service. I need in IDL-editing functionality which is not working at the moment with codemirror-graphql:

  • incomplete autosuggestion/linting for IDL
  • you should pass it prebuilt schema which is not the case as the schema itself should be created/edited

Right now I have added a few hacks to make it work somehow in my project but I'm really interested to have it natively in language services. Is it in the scope? Can I help with this?

@asiandrummer
Copy link
Contributor

@RomanGotsiy I'd greatly appreciate the help! I think graphql-language-service would be a perfect place to support those features. May I ask what your project does/is?

Within a couple days I should be able to: 1) merge your changes to graphql-language-service, and 2) use a shared library to achieve language service features in this repo. Feel free to PR to graphql-language-service repo with said features as you like, and I'll be sure to attend to them!

@RomanHotsiy
Copy link
Contributor Author

I am working on a mock-server tool together with my college @IvanGoncharov. We leverage directives in IDL for configuring. For users to work easier with our tool we've set up a simple IDL editor. This PR adds support for autocompletion for directives which was the must for us.

image

But types autocompletion does not work + for example non-existing types are not linted, etc.
Moreover it doesn't pick up the changes from the edited IDL. So to have this working I am running buildSchema with each keystroke and if it doesn't fail I apply resulting schema to the editor :)

These problems are not limited to our tool. I believe this is a very common issue and I would love to help with this.

Let me know when you are ready with merging/refactoring this repo. Maybe we could chat then to discuss those features and ways to implement them.

@asiandrummer
Copy link
Contributor

@RomanGotsiy definitely! Language service features for schema IDL is very interesting and would be of a high value if we can have it.

Just an intermediate idea - one way to achieve updating schema on the fly with added schema IDL is to pass the edited content for onEdit event from codemirror (any IDEs really), parse the query passed in, and extend the cached schema (in-memory) with found IDL nodes. In GraphiQL's point of view, this could happen when the component mounts for the first time as well.

Let me open an issue and include you when I get the migration done ;)

@RomanHotsiy
Copy link
Contributor Author

RomanHotsiy commented Mar 14, 2017

parse the query passed in, and extend the cached schema (in-memory) with found IDL nodes. In GraphiQL's point of view, this could happen when the component mounts for the first time as well.

that't very similar to what I do :)

Let me open an issue and include you when I get the migration done ;)

awesome! thank you!

asiandrummer added a commit to graphql/graphql-language-service that referenced this pull request Mar 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants