Coder Social home page Coder Social logo

Comments (8)

phated avatar phated commented on April 28, 2024 2

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.

sunli829 avatar sunli829 commented on April 28, 2024 1

@krevativ I added a boilerplate test code. 😁

from async-graphql.

charigami avatar charigami commented on April 28, 2024

Can you elaborate more on which parts should be tested?

from async-graphql.

sunli829 avatar sunli829 commented on April 28, 2024

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.

sunli829 avatar sunli829 commented on April 28, 2024

I'll write a boilerplate code today, it shows how to do this test.

from async-graphql.

charigami avatar charigami commented on April 28, 2024

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.

charigami avatar charigami commented on April 28, 2024

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:

  1. 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).

  2. What about the __schema field? It is a part of introspection spec. Should it be tested too?

  3. I think subscriptions should also be tested. But I don't know how? :)

from async-graphql.

sunli829 avatar sunli829 commented on April 28, 2024
  1. 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.

  1. What about the __schema field? It is a part of introspection spec. Should it be tested too?

I hope this can be tested.

  1. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.