-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add schema introspection support and execution-related APIs #758
Conversation
220bc7a
to
52cde13
Compare
Converted to draft for:
https://spec.graphql.org/October2021/#sec-Schema-Introspection
This could say from the root of a query, but it says from the type of the root of a query, which suggests this is valid: schema { query: Fibonacci }
type Fibonacci { value: Int, next: Fibonacci }
query { value next { value next { __schema { description }}}} I suspect this is not intended. |
Extracted from #758 Co-authored-by: Renée <[email protected]>
52cde13
to
071e362
Compare
I pushed a rework of error handling. |
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 should probably merge this in without making too many more changes, and then incrementally improve after we get a chance to try it out in the router (like you said before, Simon).
Ideally we'd try integrating it in the router, see if our users have any feedback, implement tests from graphql-js implementations and make this API a 1.0 with the compiler. But yea, regardless, let's get this in.
use expect_test::expect; | ||
use expect_test::expect_file; | ||
|
||
#[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.
sometime later we should port over the graphql-js introspection & execution tests
Using `GraphQLLocation::from_node` from #758 We could also have an optional `ToDiagnostic::location()` method and a provided `ToDiagnostic::to_json(&SourceMap)` to let people do this easily with their own errors. It's probably worth having now as we will also have JSON error types in introspection
% Conflicts: % crates/apollo-compiler/CHANGELOG.md
Alright, this is now fully ready for review! Please also take a look at |
I think you should merge, @SimonSapin ^__^ |
% Conflicts: % crates/apollo-compiler/CHANGELOG.md
Changelog:
apollo_compiler::execution
for a GraphQL response, its data, and errors.All (de)serializable with
serde
.coerce_variable_values()
in that same module.apollo_compiler::execution::SchemaIntrospection
providing full execution for the schema introspection parts of an operation
and separating the rest to be executed separately.
In order to support all kinds of introspection queries this actually includes
a full execution engine where users provide objects with resolvable fields.
At this time this engine is not exposed in the public API.
If you’re interested in it let us know about your use case!
ExecutableDocument::insert_operation
convenience method.Replaces and closes #645:
async
was removed (since unused by introspection, the only user)