Can you use fragments in graphql server schema file
Asked Answered
M

1

7

Can you use fragments in graphql server schema file? Could you please point me to an example

Mohair answered 23/1, 2018 at 5:10 Comment(0)
S
7

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.

Skipton answered 25/1, 2018 at 10:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.