Open praneetloke opened 1 year ago
The following introspection query allows us to fetch mutations (substitute mutationType
for queryType
for queries) and their return types. Since GraphQL does not have HTTP verbs, we'll have to use the operation name as a hint for what type of operation a certain query will perform in the backend. For example, createXYZ or deleteXYZ is for creating and deleting a type called XYZ.
{
__schema {
mutationType {
fields {
name
description
type {
ofType {
name
kind
ofType{
name
kind
ofType{
name
kind
}
}
}
}
}
}
}
}
And this query returns all types along with their fields:
{
__schema {
types {
name
fields {
description
deprecationReason
name
type {
name
ofType{
kind
name
ofType{
kind
name
}
}
}
}
}
}
}
Some cloud providers only support GraphQL for their public API. It would be good to understand how we can use GraphQL introspection to gather information CRUD operations for resources.