Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composition-js/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ export class ValidationState {
for (const pathInfo of this.subgraphPathInfos) {
const tailSubgraphName = pathInfo.path.path.tail.source;
const tailSubgraphEnumValue = subgraphNameToGraphEnumValue.get(tailSubgraphName);
const tailTypeName = pathInfo.path.path.tail.type.name;
const entryKeys = [];
const contexts = Array.from(pathInfo.contexts.entries());
contexts.sort((a, b) => a[0].localeCompare(b[0]));
Expand All @@ -649,7 +650,7 @@ export class ValidationState {
entryKeys.push(`${context}=${subgraphEnumValue}.${typeName}`);
}
subgraphContextKeys.add(
`${tailSubgraphEnumValue}[${entryKeys.join(',')}]`
`${tailSubgraphEnumValue}.${tailTypeName}[${entryKeys.join(',')}]`
);
}
return subgraphContextKeys;
Expand Down
9 changes: 9 additions & 0 deletions query-graphs-js/src/graphPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,15 @@
// We can now continue on dealing with the actual field.
}

if (
transition.kind === 'DownCast'
&& transition.castedType.name === path.tail.type.name

Check warning on line 1740 in query-graphs-js/src/graphPath.ts

View check run for this annotation

Codecov / codecov/patch

query-graphs-js/src/graphPath.ts#L1740

Added line #L1740 was not covered by tests
) {
// Due to output type covariance, a downcast supergraph transition may be a no-op on the
// subgraph path. In these cases, we effectively ignore the type condition.
return [path];

Check warning on line 1744 in query-graphs-js/src/graphPath.ts

View check run for this annotation

Codecov / codecov/patch

query-graphs-js/src/graphPath.ts#L1744

Added line #L1744 was not covered by tests
}

const options: GraphPath<Transition, V>[] = [];
const deadEndClosures: UnadvanceableClosure[] = [];

Expand Down