You can now run introspection queries on Appwrite's GraphQL API. With introspection enabled, you get:
- IDE autocomplete for queries, mutations, and fields
- Schema exploration using tools like GraphQL Playground, Insomnia, or Postman
- Type generation for strongly-typed clients in your preferred language
Here's how to fetch the schema using the Appwrite SDK:
JavaScript
import { Client, Graphql } from "appwrite";
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>');
const graphql = new Graphql(client);
const schema = await graphql.query({ query: `{ __schema { types { name } queryType { fields { name } } mutationType { fields { name } } } }`});
console.log(schema.data);