Skip to content
This repository was archived by the owner on Oct 26, 2022. It is now read-only.
This repository was archived by the owner on Oct 26, 2022. It is now read-only.

[FEAT] Cache introspection queries #62

@alecgorge

Description

@alecgorge

Is your feature request related to a problem? Please describe.
This project looks almost perfect for addressing some hotspots in our code!

Describe the solution you'd like
I would like to be able to apply caching to the introspection fields/queries. Introspection queries are currently the heaviest GraphQL query we face because we have a very large schema—but our schema doesn't change while the server is running. I plan on using a cache key of the build number + schema name in production.

It isn't clear to me how to attach caching to these automatically provided fields.

Additional context
We are open to other solutions besides caching at the field level but aren't keen on directly matching against the query because when we open up our GraphQL API to more 3rd parties we can't ensure they always introspect in the same way.

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

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions