Skip to content

Commit

Permalink
sync metadata docs with LSP (#674)
Browse files Browse the repository at this point in the history
Co-authored-by: hasura-bot <[email protected]>
Co-authored-by: Rob Dominguez <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2024
1 parent 1261a20 commit b90c793
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 256 deletions.
28 changes: 16 additions & 12 deletions docs/plugins/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The `pre-parse` plugin is triggered at the first step in the execution pipeline,
step to add custom logic before parsing begins.

For pre-parse plugin configuration
[click here](supergraph-modeling/engine-plugins.mdx#lifecyclepluginhook-lifecyclepluginhookpreparse)
[click here](supergraph-modeling/engine-plugins.mdx#lifecyclepluginhook-lifecyclepreparsepluginhook)

### Pre-Parse Plugin Request

Expand All @@ -100,7 +100,7 @@ A sample request that is sent to the `pre-parse` plugin is as follows:
```

**Note**: The request sent to the plugin can be customized based on the plugin's
[configuration](supergraph-modeling/engine-plugins.mdx#lifecyclepluginhook-lifecyclepluginhookconfigrequest).
[configuration](supergraph-modeling/engine-plugins.mdx#lifecyclepluginhook-lifecyclepreresponsepluginhookconfigrequest).

### Pre-Parse Plugin Response

Expand Down Expand Up @@ -129,14 +129,14 @@ the metadata.
Please note that if a plugin returns a `Response`, `User Error` or `Internal Error` response, the execution stops and
the response is sent to the client. The subsequent plugins are not executed.

Let's take an example where the engine is confiured with two pre-parse plugins: `Pre-parse hook 1` and `Pre-parse hook
2`.
Let's take an example where the engine is confiured with two pre-parse plugins: `Pre-parse hook 1` and
`Pre-parse hook 2`.

<Thumbnail src="/img/plugins/multiple-pre-parse-plugins.jpg" alt="Multiple pre-parse plugins" width="750px" />

In this example, the engine is configured with two pre-parse plugins. The engine sends the request to `Pre-parse hook
1`, which processes the request and sends a response. Now, depending on the response, the engine either continues with
the execution or stops and sends the response to the client.
In this example, the engine is configured with two pre-parse plugins. The engine sends the request to
`Pre-parse hook 1`, which processes the request and sends a response. Now, depending on the response, the engine either
continues with the execution or stops and sends the response to the client.

#### Case 1: Continue

Expand All @@ -152,11 +152,15 @@ The `Continue` response body is ignored by DDN. The plugin can return an empty r
#### Case 2: Response/ User Error/ Internal Error

If `Pre-parse hook 1` returns a `Response` response (HTTP status code is 200) or a `User Error` response (HTTP status
code is 400) or an `Internal Error` response (HTTP status code is 500), the engine stops the execution and sends
the response to the client. The subsequent plugins are not executed.

<Thumbnail src="/img/plugins/multiple-pre-parse-plugins-p1-response.jpg" alt="Multiple pre-parse plugins with 1st plugin
response being sent to the client" width="750px" />
code is 400) or an `Internal Error` response (HTTP status code is 500), the engine stops the execution and sends the
response to the client. The subsequent plugins are not executed.

<Thumbnail
src="/img/plugins/multiple-pre-parse-plugins-p1-response.jpg"
alt="Multiple pre-parse plugins with 1st plugin
response being sent to the client"
width="750px"
/>

If all the pre-parse plugins return a `Continue` response (HTTP status code 204), the engine continues with the
execution and sends the response generated by the engine to the client.
Expand Down
Loading

0 comments on commit b90c793

Please sign in to comment.