Skip to content

fix: avoid duplicate errors for external fields - #337

Closed
kamilkisiela wants to merge 1 commit into
fix/composition-crash-on-unresolvable-selection-setfrom
fix/no-duplicate-field-type-mismatch-for-external
Closed

kamilkisiela wants to merge 1 commit into
fix/composition-crash-on-unresolvable-selection-setfrom
fix/no-duplicate-field-type-mismatch-for-external

Conversation

@kamilkisiela

@kamilkisiela kamilkisiela commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

An @external field with a different type could report two errors FIELD_TYPE_MISMATCH and EXTERNAL_TYPE_MISMATCH

An @external field only points to a field owned by another subgraph, so it should not be part of the normal field type check.

We now skip external fields there and let ExternalTypeMismatchRule report the error instead.

Key fields are still checked because ExternalTypeMismatchRule skips them.

This also moves the Federation v1 external-field check into isExternalInGraph.

An `@external` declaration mirrors a field it does not own, so it does not take part in
merging that field's type - `object-type.ts` already excludes it when computing
`fieldState.type`. `ExternalTypeMismatchRule` then compares each external declaration
against the merged type, but `FieldsOfTheSameTypeRule` counted them as merge participants
too, so a single disagreement surfaced under both codes.

Skip external declarations in the field type merge check, except on key fields, which
`ExternalTypeMismatchRule` skips and would otherwise go unreported.

The `isExternal` expression, with its Federation v1 extension caveat, was copy-pasted in
three places; extracted as `isExternalInGraph`.
@kamilkisiela
kamilkisiela force-pushed the fix/composition-crash-on-unresolvable-selection-set branch from eac3247 to b937358 Compare September 22, 2026 14:23
@kamilkisiela
kamilkisiela force-pushed the fix/no-duplicate-field-type-mismatch-for-external branch from e8f9124 to 6792e0f Compare September 22, 2026 14:23
@kamilkisiela kamilkisiela changed the title fix: do not report FIELD_TYPE_MISMATCH next to EXTERNAL_TYPE_MISMATCH fix: avoid duplicate errors for external fields Sep 22, 2026
@kamilkisiela
kamilkisiela deleted the fix/no-duplicate-field-type-mismatch-for-external branch September 22, 2026 14:35
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.

1 participant