시작하기
시작하기스키마 인트로스펙션이란

스키마 인트로스펙션이란

스키마 인트로스펙션은 GraphQL이 스키마에 관한 정보를 제공하는 메커니즘으로, 동일한 GraphQL 언어를 사용하여 조회됩니다. GraphiQL이나 GraphQL Voyager와 같은 클라이언트가 GraphQL 스키마와 상호작용할 수 있도록 도와주는 것은 바로 이 인트로스펙션 덕분입니다.

이러한 클라이언트들은 스키마의 전체 데이터를 가져오기 위해 항상 동일한 인트로스펙션 쿼리를 실행합니다:

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
              }
            }
          }
        }
      }
    }
  }
}