question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for schema IDL language

See original GitHub issue

Language service features for schema IDL language would be amazing to have - there has already been some work done to begin the effort. After talking with some folks and researching on some ongoing efforts, I think I’m ready to propose a plan:

  • Changes to graphql-js
  • Modify the code to throw validation errors to include a source location
  • Write a schema validator
// For example,
// in graphql-js/src/validation/rules/SchemaValidator.js
export function SchemaValidator(context: ValidationContext): any {
  return {
    // This will consist of all sanity/invariant checks in buildASTSchema/extendSchema
    // For example,
    TypeExtensionDefinition(node) {
      if (!context.getSchema().getType(node.definition.type.value) {
        context.reportError(new GraphQLError(
          `Cannot extend type "${extendedTypeName}" because it does not ` +
          'exist in the existing schema.',
          [ def.definition ],
        ));
      }
    },
  };
}
  • Diagnostics
  • Add another step to extract/validate using buildASTSchema/schema validator
  • Autocompletion
  • Add support for IDL language
  • GraphQL language server
  • MessageProcessor should be able to grab the edited content, run the above schema validator, and extend the schema
  • MessageProcessor should also be able to remove type definitions from the schema on the fly
  • MessageProcessor, when the file is saved, should be able to rebuild the schema

cc @RomanGotsiy

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
acaocommented, Jun 28, 2019

we already use vscode-languageserver in our server implementation, not sure how extensively, and also vscode-jsonrpc of course, but there are a number of other official language service packages we could be using across service, interface etc to make things easier potentially. vscode-typescript-service is a good point of reference, json-service as well as it relies on an remote schema like ours. apollo’s language services are built on top of ours and aim to be more like the former. I still have a lot to learn in this arena, mostly am just focused on the graphiql monaco POC at the moment. Overall I think there are opportunities to leverage the vscode lsp packages more extensively to keep from having to maintain a lot of redundant code. If you have access to the GraohiQL Maintainers team, the first discussion post that Lee made has some comments from @martijnwalraven about these topics

1reaction
Neitschcommented, Sep 8, 2019

Hey, I have to apologise. I must have been looking at an outdated version. I’m glad we already tackled using the VSCode package. Yeah, then let’s move forward with this 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

IDL Language - Apache Avro
The aim of the Avro IDL language is to enable developers to author schemata in a ... Apache Avro IDL Schema Support 203.1.2...
Read more >
Supported Inter-Language Communication Techniques
IDL supports a number of different techniques for communicating with the operating system and programs written in other languages.
Read more >
Apache Avro IDL Schema Support - IntelliJ IDEs Plugin
Avro IDL Schema Support extends Intellij IDEs to more easily work with Avro schemata and protocols in IDL or JSON format. IDL (...
Read more >
Writing a schema - FlatBuffers - Google
The syntax of the schema language (aka IDL, Interface Definition Language) should look quite familiar to users of any of the C family...
Read more >
Language Guide (proto3) | Protocol Buffers - Google Developers
In languages that support open enum types with values outside the range of specified symbols, such as C++ and Go, the unknown enum...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found