Skip to content
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

GraphQL Endpoint Language #15

Closed
jimkyndemeyer opened this issue Jun 22, 2016 · 6 comments
Closed

GraphQL Endpoint Language #15

jimkyndemeyer opened this issue Jun 22, 2016 · 6 comments
Assignees
Labels

Comments

@jimkyndemeyer
Copy link
Collaborator

jimkyndemeyer commented Jun 22, 2016

The endpoint language is a variation on the schema shorthand from Facebook.

The purpose of the endpoint language is to declaratively express how a schema is implemented. This includes:

  • Field resolution based on meta-data annotations such as @datafetcher.
  • Splitting a large schema into multiple files
  • Endpoint code-generation for both server and client

The main syntactic differences from the shorthand are as follows:

  • Import declarations which allows the schema implementation to be spread across multiple files
  • "Auto implementation" of fields in a type that should implement one or more interfaces
  • Meta-data on fields is placed before the field, similar to Java annotations, e.g.

Code example:

# file: main.graphqle

# import the Bar interface:
import "bar-schema-fragment"

type Foo implements Bar {
  @DataFetcher("fooAwesomeFieldDataFetcher")
  awesomeField: String
  # fields from Bar are auto-implemented, but can be declared again to add annotations
}

This issue tracks basic language support:

  • .graphqle file type
  • Parser
  • Lexer
  • Syntax highlighting
  • Formatter
  • Folding
  • Completion
@jimkyndemeyer jimkyndemeyer self-assigned this Jun 22, 2016
jimkyndemeyer pushed a commit that referenced this issue Jun 27, 2016
…ced configurable schema annotations in graphql.config.json (#15)
jimkyndemeyer pushed a commit that referenced this issue Jul 1, 2016
…ic Go to declaration and Find usages on schema type definitions. (#15)
jimkyndemeyer added a commit that referenced this issue Jul 3, 2016
jimkyndemeyer added a commit that referenced this issue Jul 3, 2016
jimkyndemeyer pushed a commit that referenced this issue Jul 5, 2016
jimkyndemeyer pushed a commit that referenced this issue Jul 8, 2016
…en used as field name or argument name. Fixed floating point number regex. (#15)
jimkyndemeyer added a commit that referenced this issue Sep 18, 2016
…ration (#15)

Added new file template for GraphQL Endpoint Language
jimkyndemeyer added a commit that referenced this issue Sep 20, 2016
Folding and formatter now supports field arguments
jimkyndemeyer added a commit that referenced this issue Sep 28, 2016
jimkyndemeyer pushed a commit that referenced this issue Oct 10, 2016
…sage. Added error markers on input type usages before input type declaration. (#15)
@sergehuber
Copy link

This sounds fantastic can't wait for it to be released. Is there any official specification for this endpoint language ? I couldn't find anything using Google.

@jimkyndemeyer
Copy link
Collaborator Author

@sergehuber This issue and JSGraphQLEndpointParser.bnf is the only official specification at this time. You won't find any info elsewhere since the language design is done by my colleagues and myself.

We're currently using the Endpoint language to build a product, and once we're happy with the language features, the plan is to include the language in the published plugin version.

For now, I'd recommend that you write your schema in a ".graphqls" file (right click -> New -> GraphQL Schema file). Depending on which stack you're using on the server side, the Apollo team has a great set of tools that help you create a working endpoint based on your .graphqls schema file. See their medium post.

/Jim.

@jimkyndemeyer
Copy link
Collaborator Author

Merged to master.

@vepanimas
Copy link
Collaborator

@jimkyndemeyer hi! What do you think about supporting this functionality now? It looks like it hasn't become a standard and doesn't have a specification, but it still complicates the code and requires support. Is it used by anyone? Maybe it makes sense to delete this code in the next released version, what do you think? If someone needs it, they can use one of the previous versions.

@jimkyndemeyer
Copy link
Collaborator Author

Hi @vepanimas

The GraphQL Endpoint language is actively used by teams at Elsevier, and as part of my work there I have time to support it as needed.

I could potentially see us migrating to use GraphQL SDL, but we'd have to be able to augment the completion of directive argument values and their reference resolution to get the same level of tooling. I recall having seen ways for plugins to provide extension points for other plugins?

In any case, there's a number of ways to approach cleaning this up for easier overall maintenance of the plugin. For now, is there any specific part of the code that you think needs attention due to the presence of the Endpoint language?

@vepanimas
Copy link
Collaborator

vepanimas commented Aug 27, 2020

@jimkyndemeyer ok, that's all I wanted to know. I mistakenly thought it was outdated, but if it isn't, there are many ways to slightly restructure it with extension points and isolate all the related code in a separate module.

A lot of features inside the WebStorm are done in a similar way. Usually, there is a base class with common functionality that accesses the extension point and polls some providers. For example, this is done with d.ts files, third-party plugins can provide their own definitions so that they are taken into account in the autocomplete and other features.

I think that this could be done later and incrementally, this does not prevent further development in any way.

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