Sha256: b7aba458b63904ec9ade094df9fc15ba3a3a365656b1148c7deb04884f293a52
Contents?: true
Size: 1.21 KB
Versions: 13
Compression:
Stored size: 1.21 KB
Contents
## GraphQL::Stitching::Supergraph A `Supergraph` is the singuar representation of a stitched graph. `Supergraph` is composed from many locations, and provides a combined GraphQL schema and delegation maps used to route incoming requests. ### Export and caching A Supergraph is designed to be composed, cached, and restored. Calling `to_definition` will return an SDL (Schema Definition Language) print of the combined graph schema with delegation mapping directives. This pre-composed schema can be persisted in any raw format that suits your stack: ```ruby supergraph_sdl = supergraph.to_definition # stash this composed schema in a cache... $cache.set("cached_supergraph_sdl", supergraph_sdl) # or, write the composed schema as a file into your repo... File.write("supergraph/schema.graphql", supergraph_sdl) ``` To restore a Supergraph, call `from_definition` providing the cached SDL string and a hash of executables keyed by their location names: ```ruby supergraph_sdl = $cache.get("cached_supergraph_sdl") supergraph = GraphQL::Stitching::Supergraph.from_definition( supergraph_sdl, executables: { my_remote: GraphQL::Stitching::HttpExecutable.new(url: "http://localhost:3000"), my_local: MyLocalSchema, } ) ```
Version data entries
13 entries across 13 versions & 1 rubygems