Comments (8)
More detail also exists at https://github.com/graphql/graphql-spec#introspection, include a link to the introspection tests that the spec team use.
from async-graphql.
@krevativ I added a boilerplate test code. 😁
from async-graphql.
Can you elaborate more on which parts should be tested?
from async-graphql.
Sorry, I did not describe clearly.
GraphQL allows querying the definition of Schema, called introspection. Here is a description of the introspection. http://spec.graphql.org/June2018/#sec-Introspection
Now need to write some test code, define Schema with async-graphql
, and then query it to see whether the correct output. 😁
from async-graphql.
I'll write a boilerplate code today, it shows how to do this test.
from async-graphql.
Seems to be straight forward. Now I just need to understand all possible states 😅 But I'm new to GraphQL and it's a good way to learn more about introspection. Ok I do it and try to stay close to the spec.
@sunli829 thanks for the boilerplate!
from async-graphql.
Ok I've looked more deeply into the spec. So far, these are the tests I want to write:
pub async fn test_introspection_simple_object() {}
pub async fn test_introspection_object() {}
pub async fn test_introspection_input_object() {}
pub async fn test_introspection_documentation() {}
pub async fn test_introspection_depraction() {}
pub async fn test_introspection_typename() {}
pub async fn test_introspection_schema() {}
pub async fn test_introspection_enum() {}
pub async fn test_introspection_interfaces() {}
pub async fn test_introspection_union() {}
pub async fn test_introspection_mutation() {}
What do you think?
I've also some questions:
-
What about the fields
interfaces
,possibleTypes
,enumValues
? Do they suppose to work? Because they don't or I do something wrong. (I think also theinputFields
, but I haven't tested it yet). -
What about the
__schema
field? It is a part of introspection spec. Should it be tested too? -
I think subscriptions should also be tested. But I don't know how? :)
from async-graphql.
- What about the fields interfaces, possibleTypes, enumValues? Do they suppose to work? Because they don't or I do something wrong. (I think also the inputFields, but I haven't tested it yet).
Yes, these need to be tested. For example, the specification defines that interfaces
must return null, and async-graphql
returns []
, " "
, which is not correct.
- What about the __schema field? It is a part of introspection spec. Should it be tested too?
I hope this can be tested.
- I think subscriptions should also be tested. But I don't know how? :)
For introspection, there is no difference between query
, mutation
, and subscription
.
Thanks again. 😁
from async-graphql.
Related Issues (20)
- How can we use methods outside of graphql request context? HOT 3
- Stack overflow at `Schema::new()` when generic type's method returns self
- Consider disable the default features in Axum
- Better documentation HOT 3
- Async-graphql actix_web subscriptions don't work HOT 1
- Share data between guard and resolver HOT 2
- Add #[graphql(optional)] for fields (provde less boilerplate and more correctness) HOT 2
- async-graph-axum 7.0.0 only works with axum 0.7.0
- Cannot use string to publish to async channel HOT 3
- How to extract the query name in middleware HOT 3
- Disable introspection, returns null in __typename--Dynamic Schema
- How to view the graphql endpoint in Apollo studio explorer? HOT 2
- How do you create a model that doesn't have hardcoded values? HOT 1
- Adjust `#[allow(clippy::all)]` in macro expansions to not override `clippy::disallowed_macros` HOT 2
- Unintentional breaking change, removing `#[async_trait]`, in patch release HOT 2
- Access the value of "variable" arguments (`Value::Variable`)
- Has anyone does any benchmarks because im getting extremely poor results and I do not know why? HOT 8
- Get mutable referenece to the global data defined in the `Context` or `Schema` HOT 1
- Confusing `unused_mut` warning in `#[Object]` HOT 8
- How to handle both directions of one-to-many relation in federated graph
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async-graphql.