Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 7, 2024
1 parent 31ffcbd commit 5b4b519
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 38 deletions.
8 changes: 4 additions & 4 deletions apps/frontend/src/content/docs/integrations/aiohttp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ methods:
- `async process_result(self, request: aiohttp.web.Request, result: ExecutionResult) -> GraphQLHTTPResponse`
- `def encode_json(self, data: GraphQLHTTPResponse) -> str`

## get_context
### get_context

By overriding `GraphQLView.get_context` you can provide a custom context object
for your resolvers. You can return anything here; by default GraphQLView returns
Expand Down Expand Up @@ -83,7 +83,7 @@ called `"example"`.
Then we can use the context in a resolver. In this case the resolver will return
`1`.

## get_root_value
### get_root_value

By overriding `GraphQLView.get_root_value` you can provide a custom root value
for your schema. This is probably not used a lot but it might be useful in
Expand All @@ -110,7 +110,7 @@ class Query:
Here we configure a Query where requesting the `name` field will return
`"Patrick"` through the custom root value.

## process_result
### process_result

By overriding `GraphQLView.process_result` you can customize and/or process
results before they are sent to a client. This can be useful for logging errors,
Expand Down Expand Up @@ -141,7 +141,7 @@ class MyGraphQLView(GraphQLView):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down
12 changes: 6 additions & 6 deletions apps/frontend/src/content/docs/integrations/asgi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ We allow to extend the base `GraphQL` app, by overriding the following methods:
- `async process_result(self, request: Request, result: ExecutionResult) -> GraphQLHTTPResponse`
- `def encode_json(self, response_data: GraphQLHTTPResponse) -> str`

## get_context
### get_context

`get_context` allows to provide a custom context object that can be used in your
resolver. You can return anything here, by default we return a dictionary with
Expand All @@ -78,7 +78,7 @@ called "example".
Then we use the context in a resolver, the resolver will return "1" in this
case.

### Setting response headers
#### Setting response headers

It is possible to use `get_context` to set response headers. A common use case
might be cookie-based user authentication, where your login mutation resolver
Expand All @@ -97,7 +97,7 @@ class Mutation:
return True
```

### Setting background tasks
#### Setting background tasks

Similarly, [background tasks](https://www.starlette.io/background/) can be set
on the response via the context:
Expand All @@ -116,7 +116,7 @@ class Mutation:
info.context["response"].background = BackgroundTask(notify_new_flavour, name)
```

## get_root_value
### get_root_value

`get_root_value` allows to provide a custom root value for your schema, this is
probably not used a lot but it might be useful in certain situations.
Expand All @@ -137,7 +137,7 @@ class Query:
Here we are returning a Query where the name is "Patrick", so we when requesting
the field name we'll return "Patrick" in this case.

## process_result
### process_result

`process_result` allows to customize and/or process results before they are sent
to the clients. This can be useful logging errors or hiding them (for example to
Expand Down Expand Up @@ -166,7 +166,7 @@ class MyGraphQL(GraphQL):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/content/docs/integrations/chalice.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ We allow to extend the base `GraphQLView`, by overriding the following methods:
- `process_result(self, request: Request, result: ExecutionResult) -> GraphQLHTTPResponse`
- `encode_json(self, response_data: GraphQLHTTPResponse) -> str`

## get_context
### get_context

`get_context` allows to provide a custom context object that can be used in your
resolver. You can return anything here, by default we return a dictionary with
Expand All @@ -103,7 +103,7 @@ called "example".
Then we use the context in a resolver, the resolver will return "1" in this
case.

## get_root_value
### get_root_value

`get_root_value` allows to provide a custom root value for your schema, this is
probably not used a lot but it might be useful in certain situations.
Expand All @@ -124,7 +124,7 @@ class Query:
Here we are returning a Query where the name is "Patrick", so we when requesting
the field name we'll return "Patrick" in this case.

## process_result
### process_result

`process_result` allows to customize and/or process results before they are sent
to the clients. This can be useful logging errors or hiding them (for example to
Expand All @@ -151,7 +151,7 @@ class MyGraphQLView(GraphQLView):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/content/docs/integrations/django.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ methods:
- `async process_result(self, request: HttpRequest, result: ExecutionResult) -> GraphQLHTTPResponse`
- `def encode_json(self, data: GraphQLHTTPResponse) -> str`

## get_context
### get_context

`get_context` allows to provide a custom context object that can be used in your
resolver. You can return anything here, by default we return a dictionary with
Expand All @@ -216,7 +216,7 @@ called "example".
Then we use the context in a resolver, the resolver will return "1" in this
case.

## get_root_value
### get_root_value

`get_root_value` allows to provide a custom root value for your schema, this is
probably not used a lot but it might be useful in certain situations.
Expand All @@ -237,7 +237,7 @@ class Query:
Here we are returning a Query where the name is "Patrick", so we when requesting
the field name we'll return "Patrick" in this case.

## process_result
### process_result

`process_result` allows to customize and/or process results before they are sent
to the clients. This can be useful logging errors or hiding them (for example to
Expand Down Expand Up @@ -266,7 +266,7 @@ class MyGraphQLView(AsyncGraphQLView):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down
10 changes: 5 additions & 5 deletions apps/frontend/src/content/docs/integrations/fastapi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The `GraphQLRouter` accepts the following options:
[security implications mentioned in the GraphQL Multipart Request Specification](https://github.com/jaydenseric/graphql-multipart-request-spec/blob/master/readme.md#security)
when enabling this feature.

## context_getter
### context_getter

The `context_getter` option allows you to provide a custom context object that
can be used in your resolver. `context_getter` is a
Expand Down Expand Up @@ -178,7 +178,7 @@ requires `.request` indexing.
Then we use the context in a resolver. The resolver will return “Hello John, you
rock!” in this case.

### Setting background tasks
#### Setting background tasks

Similarly,
[background tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/?h=background)
Expand Down Expand Up @@ -221,7 +221,7 @@ app.include_router(graphql_app, prefix="/graphql")
If using a custom context class, then background tasks should be stored within
the class object as `.background_tasks`.

## root_value_getter
### root_value_getter

The `root_value_getter` option allows you to provide a custom root value for
your schema. This is most likely a rare usecase but might be useful in certain
Expand Down Expand Up @@ -259,7 +259,7 @@ app.include_router(graphql_app, prefix="/graphql")
Here we are returning a Query where the name is "Patrick", so when we request
the field name we'll return "Patrick".

## process_result
### process_result

The `process_result` option allows you to customize and/or process results
before they are sent to the clients. This can be useful for logging errors or
Expand Down Expand Up @@ -290,7 +290,7 @@ class MyGraphQLRouter(GraphQLRouter):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/content/docs/integrations/flask.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async functions.
</Note>


## get_context
### get_context

`get_context` allows to provide a custom context object that can be used in your
resolver. You can return anything here, by default we return a dictionary with
Expand All @@ -92,7 +92,7 @@ called "example".
Then we use the context in a resolver, the resolver will return "1" in this
case.

## get_root_value
### get_root_value

`get_root_value` allows to provide a custom root value for your schema, this is
probably not used a lot but it might be useful in certain situations.
Expand All @@ -113,7 +113,7 @@ class Query:
Here we are returning a Query where the name is "Patrick", so we when requesting
the field name we'll return "Patrick" in this case.

## process_result
### process_result

`process_result` allows to customize and/or process results before they are sent
to the clients. This can be useful logging errors or hiding them (for example to
Expand All @@ -140,7 +140,7 @@ class MyGraphQLView(GraphQLView):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/content/docs/integrations/litestar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The `make_graphql_controller` function accepts the following options:
[security implications mentioned in the GraphQL Multipart Request Specification](https://github.com/jaydenseric/graphql-multipart-request-spec/blob/master/readme.md#security)
when enabling this feature.

## context_getter
### context_getter

The `context_getter` option allows you to provide a Litestar dependency that
return a custom context object that can be used in your resolver.
Expand Down Expand Up @@ -188,7 +188,7 @@ GraphQLController = make_graphql_controller(
app = Litestar(route_handlers=[GraphQLController])
```

### Context typing
#### Context typing

In our previous example using class based context, the actual runtime context a
`CustomContext` type. Because it inherits from `BaseContext`, the `request`,
Expand Down Expand Up @@ -283,7 +283,7 @@ GraphQLController = make_graphql_controller(
app = Litestar(route_handlers=[GraphQLController])
```

## root_value_getter
### root_value_getter

The `root_value_getter` option allows you to provide a custom root value that
can be used in your resolver
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/content/docs/integrations/quart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ We allow to extend the base `GraphQLView`, by overriding the following methods:
- `process_result(self, result: ExecutionResult) -&gt; GraphQLHTTPResponse`
- `encode_json(self, response_data: GraphQLHTTPResponse) -&gt; str`

## get_context
### get_context

`get_context` allows to provide a custom context object that can be used in your
resolver. You can return anything here, by default we return a dictionary with
Expand All @@ -74,7 +74,7 @@ called "example".
Then we use the context in a resolver, the resolver will return "1" in this
case.

## get_root_value
### get_root_value

`get_root_value` allows to provide a custom root value for your schema, this is
probably not used a lot but it might be useful in certain situations.
Expand All @@ -95,7 +95,7 @@ class Query:
Here we are returning a Query where the name is "Patrick", so we when requesting
the field name we'll return "Patrick" in this case.

## process_result
### process_result

`process_result` allows to customize and/or process results before they are sent
to the clients. This can be useful logging errors or hiding them (for example to
Expand All @@ -122,7 +122,7 @@ class MyGraphQLView(GraphQLView):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/content/docs/integrations/sanic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ methods:
- `async get_root_value(self, request: Request) -&gt; Any`
- `async process_result(self, result: ExecutionResult) -&gt; GraphQLHTTPResponse`

## get_context
### get_context

By overriding `GraphQLView.get_context` you can provide a custom context object
for your resolvers. You can return anything here; by default GraphQLView returns
Expand All @@ -69,7 +69,7 @@ called `&quot;example&quot;`.
Then we can use the context in a resolver. In this case the resolver will return
`1`.

## get_root_value
### get_root_value

By overriding `GraphQLView.get_root_value` you can provide a custom root value
for your schema. This is probably not used a lot but it might be useful in
Expand All @@ -91,7 +91,7 @@ class Query:
Here we configure a Query where requesting the `name` field will return
`&quot;Patrick&quot;` through the custom root value.

## process_result
### process_result

By overriding `GraphQLView.process_result` you can customize and/or process
results before they are sent to a client. This can be useful for logging errors,
Expand Down Expand Up @@ -120,7 +120,7 @@ class MyGraphQLView(GraphQLView):
In this case we are doing the default processing of the result, but it can be
tweaked based on your needs.

## encode_json
### encode_json

`encode_json` allows to customize the encoding of the JSON response. By default
we use `json.dumps` but you can override this method to use a different encoder.
Expand Down

0 comments on commit 5b4b519

Please sign in to comment.