router icon indicating copy to clipboard operation
router copied to clipboard

Adapt connectors expansion and validation to handle abstract types (interfaces and unions)

Open benjamn opened this issue 6 months ago • 4 comments

[!Note] This PR builds on #8616 and #8626

Supporting the ... syntax in the JSONSelection mapping language (PR #7957) allowed for conditional selections, which allows for conditionally determining the __typename of an object in GraphQL, which enables the use of abstract types (or type polymorphism): interfaces and union types that might be one of several concrete types, with the exact __typename and associated fields determined at runtime.

This PR updates the rest of the connectors system (beyond the JSONSelection language) to tolerate abstract types: relaxing validation to allow for abstract types, but also validating the fields of each concrete type; rewriting expansion to understand interfaces, unions, and JSONSelection strings that compute their __typename and other fields; and updating the shape crate to support this new functionality. The new expansion and validation traversal logic is now Shape-based, which is the achievement that allows for static analysis of conditional __typename selections.

benjamn avatar Aug 25 '25 13:08 benjamn

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/(latest)/performance/caching/response-caching/observability.mdx

Build ID: a5a5cbc4318c25fe0dda6b9a Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/a5a5cbc4318c25fe0dda6b9a

apollo-librarian[bot] avatar Aug 25 '25 13:08 apollo-librarian[bot]

Going back to draft status because this PR needs a rework to make better use of ConnectSpec version gating to ensure backwards/forwards compatibility.

benjamn avatar Sep 09 '25 15:09 benjamn

@benjamn, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

github-actions[bot] avatar Nov 14 '25 23:11 github-actions[bot]

Update: this PR has gotten a lot simpler (just two commits now!), but I still need to add proper ConnectSpec version gating, so we'll be in Draft until then.

benjamn avatar Nov 17 '25 22:11 benjamn