GraphQL Schema to Fragment Matcher Converter
Paste a GraphQL SDL schema to instantly generate Apollo Client's classic IntrospectionFragmentMatcher JSON shape for every interface and union in your schema. Free online developer tool.
Paste GraphQL Schema (SDL)
Fragment Matcher JSON
Fragment matcher JSON will appear here...
Free GraphQL Schema to Fragment Matcher Converter
Paste a GraphQL SDL schema to instantly generate Apollo Client's classic IntrospectionFragmentMatcher JSON shape, listing every concrete type that implements each interface and every member of each union in your schema.
How to Use It
Paste your GraphQL schema definition language (SDL) into the input box, or click "Load Example" to see a sample run. The tool builds a real schema with GraphQL.js, finds every interface and union type, resolves their concrete possible types using the schema's own type relationships, and emits the { "__schema": { "types": [...] } } JSON shape that Apollo Client's older IntrospectionFragmentMatcher expects.
Example
A union SearchResult = User | Post generates a types entry with "kind": "UNION", "name": "SearchResult" and "possibleTypes": [{"name": "User"}, {"name": "Post"}], letting Apollo Client correctly match fragments written against that union without a network round trip.
Common Use Cases
- Configuring Apollo Client's cache to correctly match fragments on interfaces and unions.
- Avoiding "Heuristic fragment matching going on" warnings in older Apollo Client setups.
- Auditing which concrete types implement a given interface across a large schema.
- Keeping a fragment matcher file in sync after adding a new type to an existing union.
FAQs
Is this still relevant for newer versions of Apollo Client?
Apollo Client 3+ generally recommends possibleTypes generated by @graphql-codegen/fragment-matcher instead of the older IntrospectionFragmentMatcher class, but the underlying data — which concrete types satisfy which interface or union — is the same, so this output is still useful as a reference or for projects still on the classic API.
What if my schema has no interfaces or unions?
The output's types array will simply be empty — there's nothing to resolve possible types for without at least one interface or union in the schema.
Is my schema uploaded anywhere?
No — parsing and resolution happen entirely client-side in your browser. Nothing you paste is sent to a server.
