-
Hello, I'm looking into the options how to have "private" and "public" schemas served under different urls, where private schema is a superset of public one. Is it possible to have 2 schema documents referring to the same implementation, with private fields omitted in public schema? When I try to run public schema with removed field "private", it errors out with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are two approaches to this: Schema inheritanceThis approach relies on GraphQL
The trick is to run Here's example repo that implements Permission checks on resolvers and overriding introspectionIn this approach all fields are defined in single schema, but server overrides resolvers on |
Beta Was this translation helpful? Give feedback.
There are two approaches to this:
Schema inheritance
This approach relies on GraphQL
extend
syntax which allows you to define additional fields for type after it was declared:The trick is to run
make_executable_schema
twice, and pass onlyMyType
with its resolvers to first run, andMyType
together with extend (and extra types as well as resolvers) to next run. Then you setup two GraphQL urls and let client decide if they'll query/graphql/
or/graphql/private/
. You can also put auth check in front of the URL to refuse queries without authorization to the private API.Here's example repo that implements
s…