Reputation: 253
Can you use fragments in graphql server schema file? Could you please point me to an example
Upvotes: 8
Views: 1540
Reputation: 15429
No. Fragments are defined for operations (queries) only. In other words, the client defines them ad-hoc, not the server in its schema. If what you're looking for is to reuse a bunch of definitions, I'm afraid you're constrained to implementing an interface, or just good ol' composition. Most implementations also support type extensions, graphql-java certainly does.
Upvotes: 8