apollographql / apollographql/federation

fix(federation): `composeAndValidate` throws when no base type exists

Open
#605 0 comments 0 reactions 1 assignee Claimed by @trevor-scheer View on GitHub
:beetle: bug :hugs: improvement
Dominant language
TypeScript
Stars
725
Forks
276
Avg merge
1h 47m
Merged PRs (30d)
1

Description

Attempting to `extend` a type which isn't defined in any service causes `composeAndValidate` to throw, which is not a behavior we want. `composeAndValidate` should capture all composition errors with as much helpful information as possible and return them.

While #478 aimed to address this problem in the first place, resolving this issue should mean that we land a fix which no longer requires the `try/catch` and discard error approach. These changes should be undone (though the tests can stay and be updated!).

In the weeds a bit:
It's helpful for us to compose as far as we're able to in order to collect as many errors as possible (rather than having the act of composition fail completely with no resulting schema to run validations against). In order to accomplish this in this case, we'll likely need to "create" a false base type to bypass the failure and proceed with composition. This is one option among possible others.

Related: #567
I think tackling these issues simultaneously makes a lot of sense!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.