Report

Help us improve this tool

GraphQL To Fragment Matcher

Generate Apollo Client fragment matcher introspection data from GraphQL schema SDL in your browser.

O M T

Generate Apollo Fragment Matcher from GraphQL Schema

Apollo Client uses fragment matching to resolve union and interface fields at runtime. When your schema includes interfaces or unions, you need a possibleTypes map so the cache knows which concrete types belong to each abstract type. Building that map by hand is tedious and breaks whenever the schema changes.

What this tool does

Paste GraphQL schema SDL (types, interfaces, unions, and queries). The generator outputs fragment matcher data compatible with Apollo Client InMemoryCache configuration. Results update in real time as you edit the schema.

Related tools

Need full introspection JSON instead of the matcher map? Use the GraphQL to Introspection JSON converter. For Flow or React component codegen, try the GraphQL to Flow Converter or GraphQL to Components Generator.

Frequently Asked Questions

What is a GraphQL fragment matcher?

A fragment matcher tells Apollo Client which concrete object types implement each interface or union. Without it, cached union and interface fragments may not resolve correctly when queries return mixed types.

Do I need operation documents for this tool?

No. Fragment matcher generation only needs the schema SDL. Queries and mutations are not required because possible types come from type definitions, not client operations.

How do I use the generated output with Apollo Client?

Import the generated object and pass it to InMemoryCache via the possibleTypes option, or use it with IntrospectionFragmentMatcher depending on your Apollo Client version and setup.

Does this support schemas with multiple interfaces and unions?

Yes. Any interface or union declared in the schema is included in the possibleTypes map with all implementing or member types listed.

Is my schema sent to a server?

No. Parsing and codegen run entirely in your browser. Your GraphQL schema never leaves your device.