From 50f03a861fef5790426cff6e303edc80a305c472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Pito=C5=84?= Date: Thu, 18 Apr 2024 17:20:14 +0200 Subject: [PATCH] Update docs --- GUIDE.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/GUIDE.md b/GUIDE.md index b0aaab1..514e1e1 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -445,6 +445,32 @@ app = GraphQL( ) ``` +## Creating a schema that is a subset of other schema + +Following APIs support creating a new schema that is a subset of another schema: + +- `ProxySchema.add_remote_schema` +- `ProxySchema.add_schema` +- `copy_schema` + +To create a subset of other schema, specify which fields for `queries` and (optionally) `mutations` should be available in final schema: + +```python +from ariadne_graphql_proxy import ProxySchema + +proxy_schema = ProxySchema() +proxy_schema.add_remote_schema( + "https://example.com/e-commerce/", + queries=["categories", "products"], +) +``` + +All other `Query` fields and types that weren't used by those fields will be removed from the final schema, making it much smaller. If `mutations` option was not used, `Mutation` type will also be removed from the schema. + +`queries` and `mutations` arguments can be combined with `exclude_types`, `exclude_fields`, `exclude_args`, `exclude_directives` and `exclude_directives_args`. + + + ## imgix query params resolver