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
chore: introduce query planner to router-bridge #1090
Conversation
4b831ba
to
9782a5f
Compare
9782a5f
to
a843edd
Compare
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 looks good to me.
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 is looking great! I left a few comments, but some are merely suggestions. None of them are truly blocking and I would still consider approving as-is so long via merely some back-and-forth convo, I suspect!
Thanks!
{ | ||
"extends": "../tsconfig.test.base", | ||
"include": ["**/__tests__/**/*"], | ||
"references": [ |
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.
I'm slightly unsure that we should remove this Jest configuration from this repository. Most users of this repo are not running cargo test
, but instead working in TypeScript. With this removed, they might not understand a change that they made is breaking until after it goes through CI. Could we avoid that by running something basic that we need (like a simple query plan, possibly copied from existing query plan tests?)
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.
mind pairing with me on that? I struggled a lot yesterday because whatever i tried to do the jest tests declared in the bridge wouldn't run :(
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.
On second thought, you're right, if the graphql api or the query-planner-js api changes, we might warn users that we can't run the bridge as intended
bf3c26b
to
1be695b
Compare
fixes #1088 This commit is built on top of @BrynCooke 's work on #812, and exposes a query planning functionality, which has been living in a separate branch for a while. A few things happened: General: - Remove jest tests from the router bridge (they weren't being run anyway, and they are now superseded by the cargo tests) - Add router-bridge js files to the prettier configuration for formatting and linting - Add a dependency to query-planner-js to the router-bridge TypeScript/Javascript: - Add `do_plan.ts` that calls the query-planner behind the scenes. - Use `new QueryPlanner(schema).buildQueryPlan` instead of the old `buildQueryPlan` function, that doesn't exist anymore (depending on how long we want to keep this code, we might be able to keep the QueryPlanner object around, and skip subsequent schema parsing / composing. - Move the type `OperationResult` to a utils file (so we can use it in both `do_plan.ts` and `do_introspect.ts` Rust: - Use &str instead of String for schema SDL, since apollo-rs provides as_str() on the Schema type. - Add a plan function, that is generic over it's return type ( `Result<T, PlanningErrors>` where `T: DeserializeOwned + 'static` so we can keep the `QueryPlan` structure on the router-core side. - Add plan() tests that call plan<serde_json::Value>() so we have snapshots over the plan result.
1be695b
to
0e86671
Compare
…ght that we didn't validate queries, and add a cargo test
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.
Legend!
chore: Introduce query planner to router-bridge
fixes #1088
#1079 Added a new router-bridge that binds together the rust router and some TypeScript / Javascript capabilities (introspection mostly).
This commit is built on top of @BrynCooke 's work on #812, and exposes a query planning functionality, which has been living in a separate branch for a while.
A few things happened:
General:
TypeScript/Javascript:
do_plan.ts
that calls the query-planner behind the scenes.new QueryPlanner(schema).buildQueryPlan
instead of the oldbuildQueryPlan
function, that doesn't exist anymore (depending on how long we want to keep this code, we might be able to keep the QueryPlanner object around, and skip subsequent schema parsing / composing.OperationResult
to a utils file (so we can use it in bothdo_plan.ts
anddo_introspect.ts
Rust:
Result<T, PlanningErrors>
whereT: DeserializeOwned + 'static
so we can keep theQueryPlan
structure on the router-core side.