-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use new version of async-graphql
for dynamic schema generation
#287
Conversation
async-graphql
for dynamic schemaasync-graphql
for dynamic schema
async-graphql
for dynamic schemaasync-graphql
for dynamic schema generation
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 can't believe how easy it is to understand this and at the same time it is super powerful. It's really nicely done!
I've added some smaller comments in my review, some general remarks:
- You have a whole bunch of "TODO" markers in the code which partly need to be extended or discussed. My suggestion would be to remove them and rather create GitHub issues instead? Then we can continue discussion there.
- There is a lot of underscores 😆 Don't think we make use of that naming pattern so far, what was the intention here? Is this a sign of too much dead code which needs to be removed? In general I think its good to not keep dead code around at any point.
* main: Update breaking API calls for new `p2panda-rs` version (#293) Update Cargo.lock as well Use released p2panda-rs version 0.7.0 Migrate CLI from `structopt` to `clap` (#289) Increase timeout for failing materializer test Introduce requeue flag (#286) Do transactions correctly (#285) Add libp2p service and configuration (#282)
move |ctx| { | ||
FieldFuture::new(async move { | ||
// Here we just pass up the root query parameters to be used in the fields resolver | ||
let params = downcast_id_params(&ctx); | ||
Ok(Some(FieldValue::owned_any(params))) | ||
}) | ||
}, |
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 😭😭😭 So much better
Use https://github.com/async-graphql/async-graphql and https://github.com/smmoosavi/dynamic-graphql to implement dynamic schema handling in our graphql api.
This took a little bit of time as I had to get to grips with the new
async-graphql
dynamic schema creation patterns, but I'm very happy with the result, it will be much more enjoyable (and quite quick) to expand our query api now with new features.Design decisions
async-graphql
to build all queries dynamically. It doesn't seem possible to combine "statically" defined queries with dynamic ones, so evennextArgs
is defined using the dynamic APIdynamic-graphql
which offers macro wrappers forasync-graphql
, these are then registered on the root schema and can be referenced by name in dynamic queries where object types can be definedTasks
graphql
moduleadd some more testslet's do this in next steps 😶🌫️ we at least shouldn't have fewer tests than we did before!getit already wasdynamic-schema
published or remove it from this PRNext steps
📋 Checklist
CHANGELOG.md