docs(router): align dynamic subgraph routing docs with override_subgraph_urls all/subgraphs schema#117
docs(router): align dynamic subgraph routing docs with override_subgraph_urls all/subgraphs schema#117Copilot wants to merge 2 commits into
override_subgraph_urls all/subgraphs schema#117Conversation
…s shape Agent-Logs-Url: https://github.com/graphql-hive/docs/sessions/58eeea55-7de7-4dfe-916a-70e0c4e277e2 Co-authored-by: ardatan <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates the Hive Router documentation to reflect the current override_subgraph_urls schema (with subgraphs overrides plus an optional global all fallback), and refreshes expression-context documentation used for dynamic routing.
Changes:
- Updated the Dynamic Subgraph Routing guide examples from the legacy flat
override_subgraph_urlsshape to thesubgraphs-nested structure. - Reworked the
override_subgraph_urlsconfiguration reference to documentsubgraphs.<name>.urlplus a globalall.expressionfallback and precedence. - Expanded expression docs to include
.request.url_matchesand clarified.subgraphavailability for dynamic routing expressions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/documentation/content/docs/router/guides/dynamic-subgraph-routing.mdx | Migrates guide YAML examples to override_subgraph_urls.subgraphs.* and documents .subgraph.name in routing context. |
| packages/documentation/content/docs/router/configuration/override_subgraph_urls.mdx | Documents the new all + subgraphs structure, precedence rules, and adds examples including url_matches. |
| packages/documentation/content/docs/router/configuration/expressions.mdx | Adds .request.url_matches and clarifies where .subgraph is available. |
Comments suppressed due to low confidence (3)
packages/documentation/content/docs/router/configuration/override_subgraph_urls.mdx:106
- Same as above: this section says
.requestincludes "query parameters", but the expressions docs don’t list any query-parameter field. Please align the documented.requestshape across pages (either add the missing field toexpressions.mdxor remove the mention here).
Within the `expression`, you have access to:
- `.request`: The incoming HTTP request object (headers, query parameters, parsed operation, and
`url_matches`).
- `.default`: The original subgraph URL from the supergraph schema.
- `.subgraph.name`: The name of the subgraph currently being resolved.
packages/documentation/content/docs/router/configuration/override_subgraph_urls.mdx:77
subgraphs.<name>.urlis marked as Required: Yes, which could be misread as required for the overall feature even when using onlyoverride_subgraph_urls.all. Consider clarifying the requirement as "required when defining asubgraphs.<name>override" to avoid confusion.
### `subgraphs.<name>.url`
- **Type:** `string` or `object`
- **Required:** Yes
packages/documentation/content/docs/router/configuration/override_subgraph_urls.mdx:66
- The example uses
http.graphql_endpoint: /{tenant}/graphqland refers to.request.url_matches.tenant, but thehttpconfiguration docs currently only document{wildcard}and{tail}*path captures. Either update thehttpdocs to explicitly cover named parameters like{tenant}, or adjust this example to use the documented{wildcard}/{tail}patterns to avoid inconsistency.
If `http.graphql_endpoint` uses path parameters, they are available under `.request.url_matches`:
```yaml
http:
graphql_endpoint: /{tenant}/graphql
override_subgraph_urls:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
|
Agent-Logs-Url: https://github.com/graphql-hive/docs/sessions/2eb9a164-70db-4cd9-9dc7-89ff7b2f2f49 Co-authored-by: ardatan <[email protected]>
Applied the requested thread changes in
|
Documentation graphql-hive/router#987
Router docs were still describing the legacy flat
override_subgraph_urlsshape, while router now usessubgraphsplus optional globalall. This update brings configuration and expression docs in sync with the new schema and runtime variables.Configuration reference:
override_subgraph_urlsoverride_subgraph_urls.subgraphs.<name>.urlfor per-subgraph overridesoverride_subgraph_urls.all.expressionfor global fallback logicall.Expression context updates
.request.url_matchesfor path params captured fromhttp.graphql_endpointpatterns..subgraph.nameavailability in dynamic routing expressions.Guide updates: dynamic subgraph routing
subgraphs-nested YAML.