dotansimha / graphql-yoga

🧘 Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance & great developer experience. The core of Yoga implements WHATWG Fetch API and can run/deploy on any JS environment.
https://the-guild.dev/graphql/yoga-server
MIT License
8.13k stars 561 forks source link

RFC: Fragment-arguments/experimental features #3209

Open JoviDeCroock opened 3 months ago

JoviDeCroock commented 3 months ago

Is your feature request related to a problem? Please describe.

I have been picking up the [Fragment Arguments spec]() for GraphQL, however it is hard to find a good testbed for this outside of the reference implementation.

My goal with this would be for much like we do with JS-features to already implement it in a few clients/servers.

The above imply that we'd implement the custom executor/validator/... as part of the execute used in GraphQL-Yoga and that in urql we'd still leverage graphql.web to parse fragment arguments.

That being said we're still faced with the issue of how to parse GraphQL requests in Yoga to accomodate for Fragment Arguments.

Describe the solution you'd like

We add support for experimentalFragmentArguments in GraphQL Yoga and we can allow folks to adopt it through urql (or anyone else choosing to adopt it) as a GraphQL Client. This gives us a window of feedback to advance the spec.

ardatan commented 3 months ago

Sounds interesting!

About parse function, onParse hook can be used to replace the parse function;

{
  onParse({ setParseFn }) {
     setParseFn(customParse);
  }
}
Urigo commented 3 months ago

Super exciting!

@n1ru4l can you think about a use case that could benefit from this feature on Hive?

@ardatan does it have also an affect on Mesh gateway support?

Urigo commented 3 months ago

also, are there changes needed in Codegen?

Urigo commented 3 months ago

by the way, my thinking here is not to use an experimental version of graphql-js, but to use our own implementation of parse if that will work, then it would be a good feedback to bring back to graphql-js

ardatan commented 3 months ago

For sure, we can use that parse fn in everywhere so codegen, mesh and hive can benefit from.