Git Product home page Git Product logo

Comments (9)

micimize avatar micimize commented on August 18, 2024 1

Thought I'd share a quick update on this - I implemented an alpha version in the execution and schema submodules here. It's partially modeled after graphql/type, but has execution models, and is mainly geared towards enabling intelligent codegen.

Might figure out how to/if we should PR the type definitions into a package here at some point. Not really sure where they fit in the ecosystem - maybe a gql_type module

from gql.

klavs avatar klavs commented on August 18, 2024

@micimize when you say "type-aware visitor", you want a visitor to traverse selection sets of an operation knowing the type of that selection set? Or is is about something other than selection sets?

from gql.

micimize avatar micimize commented on August 18, 2024

@klavs that's right, maybe with a way for fragment spreads to access their fragment info as well. For instance, in graphql-to-dart I have to hack fragment fields in order to have them in the spread context

from gql.

klavs avatar klavs commented on August 18, 2024

I'll need something like that for the new package:gql_code_gen. Maybe I'll be able to extract a reusable visitor. My only concern is that we only have an AST representation of the schema which might not be the best fit for providing the type information. For example, it does not provide easy access to types in a union, and implementors of an interface.

from gql.

micimize avatar micimize commented on August 18, 2024

am currently working on a more "saturated" schema model abstraction on top of the ast nodes, which should essentially solve this issue. My goal is a graphql schema data model that projects the ast tree into something more "accessible"

from gql.

klavs avatar klavs commented on August 18, 2024

Great! I managed to live without it, but it's clear that something like that is needed.

from gql.

klavs avatar klavs commented on August 18, 2024

Nice work there!

Might figure out how to/if we should PR the type definitions into a package here at some point. Not really sure where they fit in the ecosystem - maybe a gql_type module.

I have a feeling that what you've implemented in schema submodule belongs to package:gql, because GraphQLSchema would be useful as an input for the document validator. Interestingly, ExecutableDocument you've implemented in executable submodule kind of does not belong there because it wouldn't be used as an input for any validator.

This is why I went with AST-only validators initially.

Maybe we extend package:gql with:

  • package:gql/schema
  • package:gql/operation
  • package:gql/validation

On the other hand, maybe validation library does not belong to package:gql and it has to move to a separate package next to what is now your schema and execution submodules.

What do you think?

from gql.

micimize avatar micimize commented on August 18, 2024

I think it's fine to leave them all under gql. To me, gql should encapsulate core typing and soundness features. A good line in the sand would be anything useful at the static analysis phase, and without a runtime or code-generation component

from gql.

klavs avatar klavs commented on August 18, 2024

Agreed! You're welcome to open a PR with your changes.

from gql.

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.