graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Subgraph generator

Open matt-psaltis opened this issue 3 years ago • 3 comments

This is an initial attempt at the Subgraph generator.

Initial functional test to demonstrate: Stitching.Types.Tests/Attempt1/BasicDocumentMergeTests.cs

Not sure if this approach is sound, if there's existing primitives or work I should be considering here but I've had a go at this.

The basic overview:

  1. We use a syntax visitor to walk the parsed syntax tree.
  2. We build up a database of Schema nodes which wrap each level of the syntax tree with a corresponding Definition object, this helps when respinning the tree with supporting methods etc.
  3. We perform schema operations to merge extensions and type definitions together
  4. We perform other schema operations such as rename to identify and execute directives
  5. We produce a single subgraph document as an output.

There's some challenges around Interface nodes during tree respinning as they don't have a DirectiveNode analog. Not currently handling removal of orphaned objects from the Schema Database during reindexing.

I hope at the very least it can make some sense - serious lack of comments etc atm :)

matt-psaltis avatar Apr 20 '22 09:04 matt-psaltis

Github duplicated all my comments...

PascalSenn avatar Apr 20 '22 23:04 PascalSenn

I did not make any format comments. We have a few conventions but i think they are nowhere written down. We usually go through the PRs and then apply formatting, the diff is a good point of refrence

I might be a bit out of the loop and do not know exactly what you and @michaelstaib have already discussed. I think generally we are going into the right direction. I guess we need a few iterations to get this correctly.

I think we can align a few things (Visitors, Merging etc.) with how we handled it in the core and can also reduce the abstraction layer a bit.

I would propose that @michaelstaib has a look at it too and then when we are all on the same track we can make a meeting and discuss things through.

Given an open source project, is everyone using R#? Do we or could we get some formatting rules going?

matt-psaltis avatar Apr 20 '22 23:04 matt-psaltis

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 02 '22 13:07 stale[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 17 '22 14:08 CLAassistant