Skip to content

Conversation

@benjamn
Copy link
Member

@benjamn benjamn commented Aug 25, 2025

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 benjamn self-assigned this Aug 25, 2025
@apollo-librarian
Copy link

apollo-librarian bot commented Aug 25, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: dec2409d5cdf91b7c16e84b1
Build Logs: View logs

@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch 2 times, most recently from 4244cb9 to 6aef3e2 Compare August 26, 2025 19:01
@benjamn benjamn marked this pull request as ready for review August 26, 2025 21:36
@benjamn benjamn requested review from a team as code owners August 26, 2025 21:36
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 7e3a018 to daa3c07 Compare September 2, 2025 14:59
@benjamn benjamn requested a review from a team as a code owner September 2, 2025 14:59
@benjamn benjamn changed the base branch from am/connectorspreview to benjamn/dynamic-connectors-response-mapping September 2, 2025 15:00
@benjamn benjamn force-pushed the benjamn/dynamic-connectors-response-mapping branch 2 times, most recently from a7d8dc6 to 542122e Compare September 2, 2025 17:14
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from daa3c07 to 58c3f1e Compare September 2, 2025 21:22
@benjamn benjamn changed the base branch from benjamn/dynamic-connectors-response-mapping to benjamn/better-nullish-coalescing-union-shapes September 2, 2025 21:34
Base automatically changed from benjamn/better-nullish-coalescing-union-shapes to benjamn/dynamic-connectors-response-mapping September 7, 2025 14:57
@benjamn benjamn force-pushed the benjamn/dynamic-connectors-response-mapping branch from 4ae2941 to eef1acc Compare September 7, 2025 14:58
@benjamn benjamn force-pushed the benjamn/dynamic-connectors-response-mapping branch from eef1acc to 43f056a Compare September 7, 2025 15:10
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 58c3f1e to d136783 Compare September 7, 2025 15:13
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from d136783 to 331d46f Compare September 7, 2025 16:52
@benjamn benjamn force-pushed the benjamn/dynamic-connectors-response-mapping branch from 2a35586 to 756e131 Compare September 8, 2025 19:31
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 331d46f to 4655d8e Compare September 8, 2025 19:37
@benjamn benjamn force-pushed the benjamn/dynamic-connectors-response-mapping branch 2 times, most recently from 0c91f46 to d355501 Compare September 8, 2025 20:01
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 4655d8e to 51ded4c Compare September 8, 2025 20:05
@benjamn benjamn marked this pull request as draft September 9, 2025 15:33
@benjamn
Copy link
Member Author

benjamn commented Sep 9, 2025

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

Base automatically changed from benjamn/dynamic-connectors-response-mapping to dev November 12, 2025 15:37
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 51ded4c to 2d03e6b Compare November 14, 2025 23:33
@github-actions
Copy link
Contributor

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

@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 2d03e6b to 018fdc8 Compare November 17, 2025 22:14
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 018fdc8 to 2c0bb3c Compare November 17, 2025 22:26
@benjamn benjamn changed the base branch from dev to benjamn/SchemaTypeRef-instead-of-Node-ObjectType November 17, 2025 22:27
@benjamn
Copy link
Member Author

benjamn commented Nov 17, 2025

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 benjamn force-pushed the benjamn/SchemaTypeRef-instead-of-Node-ObjectType branch from a93d0b6 to f3aafe4 Compare November 18, 2025 15:30
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 2c0bb3c to 65f2f4d Compare November 18, 2025 15:31
@benjamn benjamn force-pushed the benjamn/SchemaTypeRef-instead-of-Node-ObjectType branch from a77dfd2 to 8d679e0 Compare December 4, 2025 20:11
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from f769f51 to 1e6c80d Compare December 4, 2025 20:11
@benjamn benjamn force-pushed the benjamn/SchemaTypeRef-instead-of-Node-ObjectType branch from 8d679e0 to eaf069f Compare December 4, 2025 20:56
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 1e6c80d to 9cd4372 Compare December 4, 2025 20:57
@benjamn benjamn force-pushed the benjamn/SchemaTypeRef-instead-of-Node-ObjectType branch from eaf069f to e16d56d Compare December 4, 2025 22:13
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 9cd4372 to 1aafc27 Compare December 4, 2025 22:13
@benjamn benjamn force-pushed the benjamn/SchemaTypeRef-instead-of-Node-ObjectType branch from e16d56d to 9f44e1c Compare December 5, 2025 14:33
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 1aafc27 to f823c7d Compare December 5, 2025 14:33
@benjamn benjamn force-pushed the benjamn/SchemaTypeRef-instead-of-Node-ObjectType branch from 9f44e1c to 41756d9 Compare December 5, 2025 21:51
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch 4 times, most recently from ca6ee21 to 53fc018 Compare December 5, 2025 22:32
Note that we now have distinct `NamedSelection::parse_v0_3` and
`NamedSelection::parse_v0_4` functions to preserve the differences
between the versions for backwards/forwards compatibility.
Note: shape-based validation does work for v0.3, since -> method shape
checking was quietly reenabled in v0.3 to support URI templating
validation and a few other use cases, but it's important to match the
old behavior we shipped.
@benjamn benjamn force-pushed the benjamn/SchemaTypeRef-instead-of-Node-ObjectType branch from 41756d9 to 56ab2fc Compare December 8, 2025 15:37
@benjamn benjamn force-pushed the benjamn/connectors-abstract-types-validation-and-expansion branch from 53fc018 to d6d88b7 Compare December 8, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants