-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate composite schema in spec'd form #305
Conversation
This commit cuts the gateway over to relying solely on the `composedSdl` output from composition. This unlocks the ability for either a user or Apollo Studio to serve the gateway CSDL instead of each SDL file per service. This is fairly straightforward, as `schema` was only depended on in one place by query plan execution, during the final pass of graphql-js `execute()`. Instead, we now construct a `GraphQLSchema` ourselves from the CSDL. This comes with a caveat: the schema we're creating doesn't have all of the annotations that once existed in the schema that we were using from `composeAndValidate()`. However, this is inconsequential for the way the schema is currently being used during the final execution pass.
This commit reverts e93d8d4, which was once necessary (as its own description notes) for Node.js 6, which is no longer a supported runtime of this package (it is far outside Node.js LTS support).
…lup-federation-js
* Uses a `harmonizer-js` which is a Rollup-able library that produces the IIFE. * Uses a library called `harmonizer` which invokes the IIFE via Deno's wrapper for V8. * Binary called `compose` invokes the `harmonizer` lib. * `build.rs` script that takes care of invoking the TypeScript compilation as well as the Rollup packing.
… into qv/implement-cs
federation-js/src/csdlDefinitions.ts
Outdated
@@ -0,0 +1,32 @@ | |||
export default ` | |||
directive @cs__key(graph: cs__Graph!) | |||
repeatable on FRAGMENT_DEFINITION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going forward with using fragment defs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are… trying it. part of the point of this PR is to get the whole repo into a shape where we can try it, hate it, change it, and be able to propagate those changes through the codebase without manually changing test fixtures
federation-js/src/csdlDefinitions.ts
Outdated
@@ -0,0 +1,32 @@ | |||
export default ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that there may be value in exporting the defs for each of these individually as well as a default export which combines all of them into the same document as they are now. Only speculating, so take this with a grain of salt.
federation-js/src/csdlDefinitions.ts
Outdated
provides: cs__SelectionSet) | ||
on FIELD_DEFINITION | ||
|
||
directive @cs__error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have multiple errors at a single location potentially? repeatable
?
printFederationTypeDirectives(type) + | ||
printFields(options, type) | ||
printFields(options, type) + | ||
printKeys(type) | ||
); | ||
} | ||
|
||
// Federation change: print usages of the @owner and @key directives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment
harmonizer/src/do_compose.js
Outdated
// print(composed.composedSdl); | ||
// } | ||
|
||
done(composed.errors ? { Err: composed.errors } : { Ok: composed.composedSdl }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, something running this file is putting done
and composition
in scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it's injected in lib.rs
@@ -22,6 +20,8 @@ directive @provides(fields: String!) on FIELD_DEFINITION | |||
|
|||
directive @requires(fields: String!) on FIELD_DEFINITION | |||
|
|||
directive @using(spec: String!) on SCHEMA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be repeatable
, yeah?
…cargo watch flapping due to fs changes
… and create the Bounds trait to get bounds if desired.
… prefix on the @join directive)
While this package was added to the `package.json` in the PR this implementation was extracted from in #305, it does not appear to be actually used in the `rollup.config.js`.
#559 is meant to supersede this. |
Update the composer's printer to generate a composite schema that follows the current draft spec.
This PR was based on:
schema
.qv/using
branch (which is Rust implementation of the core spec #326) merged into it.Note
#559 is meant to supersede this.