DémarrageQu'est-ce que l'introspection du schéma
Qu'est-ce que l'introspection du schéma
L'introspection du schéma est le mécanisme de GraphQL pour fournir des informations sur le schéma, récupérées en utilisant le même langage GraphQL. C'est grâce à l'introspection que des clients comme Introduction au client GraphiQL et Introduction au client Voyager peuvent nous aider à interagir avec le schéma GraphQL.
Ces clients exécutent toujours la même requête d'introspection pour obtenir les données complètes du schéma :
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type {
...TypeRef
}
defaultValue
}
fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}