Git Product home page Git Product logo

Comments (1)

vepanimas avatar vepanimas commented on June 9, 2024

@andimarek Hello! Thank you for considering this issue. The main difficulty with using the graphql-java library as is, lies in its design for very different use cases. From the IDE perspective, we need a library that can build a schema quickly and frequently. It should offer ways to extend types, fine-tune the schema-building and validation process, and crucially, handle schemas that are broken 90 percent of the time during editing in the editor.

The situation is further complicated because we use graphql-java not only for validation, but also for reference resolution, and completion. If a schema is not completely accurate, it can create various issues. For instance, all queries and types in the IDE might be marked as read, and there might be no autocompletion.

I have a list of the changes I've made over the past years. However, not all of these modifications have been implemented, or I may forget to mention some of them here:

  1. We need the ability to extend both types and nodes. Consider the constructor of AbstractNode. Since additionalData is a String map, it can't store IDE's data. Therefore, I've extended the constructor to accept a PSI node and a collection of other source nodes. This is useful when a node is built from multiple nodes with the same name. Additionally, I've overridden the method to calculate source location based on this information.
  2. You deprecated type constructors some time ago. I've seen an issue where you were resistant to changing that, but it's also necessary to extend types.
  3. Defensive copying creates substantial pressure on the GC when editing a schema file and continuously building new schemas in the background.
  4. We need to configure the schema print output format flexibly, as our GraphQL formatter is not yet implemented.
  5. Likely, we need the ability to construct a schema and replace type references lazily.
  6. Instead of throwing errors and making assertions, we need to store the error and continue with schema building and validation. Many assertions, see a commit 08d08c4, have been removed to achieve this. For example, 08d08c4#diff-2f22382be9e83bd8a1812df273f85a43588a78d79d49cfc859853889aff9ffd2R43, 08d08c4#diff-6c2708a17808e6d4e8f811dfa0be99a25fd3d4dec518e4241cd3a30e2d6cdd96R20, 08d08c4#diff-2243acc5cc1120d48dbd9896dbb03a4644b562edfef35ba426d50f94fd546662R120, and many more.
  7. We need the ability to customize error messages. For example, see 41fc0b8.
  8. Tolerate schema errors, such as:
    1. Missing types.
    2. Duplicate types with the same names (provide a merge strategy for them, but retain the original types with all related information).
    3. Incomplete syntax. For example, type Query { id: ID name: <caret> } should be a valid type in the schema with an id field and a name field without a type (and this also will cause an assertion in the current implementation of graphql-java).
  9. The schema building process should be cancellable. In IntelliJ IDEA, this is achieved using ProgressIndicator, for instance, through a call like ProgressManager.checkCanceled(). This function should be called frequently to cancel an ongoing schema building operation if the user changes a syntax tree concurrently and the schema is requested again.

I'm eager to participate in this activity and contribute. However, I'm not sure if this aligns with your priorities and vision for the future of graphql-java. If not, my plan is to completely rewrite both the resolve and completion from scratch, using graphql-java solely for query validation, and finally remove it from the repository to be able to update it regularily.

from js-graphql-intellij-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.