Skip to content

Commit 9f2b823

Browse files
committed
chore: address PR feedback and fix tests
1 parent c2fd00a commit 9f2b823

File tree

4 files changed

+63
-40
lines changed

4 files changed

+63
-40
lines changed

composition-go/index.global.js

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composition/src/errors/errors.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,10 @@ export function semanticNonNullLevelsIndexOutOfBoundsErrorMessage({
16321632
typeString,
16331633
value,
16341634
}: SemanticNonNullLevelsIndexOutOfBoundsErrorParams) {
1635-
return `Index "${value}" is out of bounds for type ${typeString}; valid indices are 0–${maxIndex} inclusive.`;
1635+
return (
1636+
`Index "${value}" is out of bounds for type ${typeString}; ` +
1637+
(maxIndex > 0 ? `valid indices are 0-${maxIndex} inclusive.` : `the only valid index is 0.`)
1638+
);
16361639
}
16371640

16381641
export function semanticNonNullLevelsNonNullErrorMessage({

composition/src/v1/federation/federation-factory.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,16 +2190,34 @@ export class FederationFactory {
21902190
}
21912191

21922192
pushVersionTwoDirectiveDefinitionsToDocumentDefinitions() {
2193+
if (!this.isVersionTwo) {
2194+
if (this.referencedPersistedDirectiveNames.has(SEMANTIC_NON_NULL)) {
2195+
this.clientDefinitions.push(SEMANTIC_NON_NULL_DEFINITION);
2196+
this.routerDefinitions = [DEPRECATED_DEFINITION, SEMANTIC_NON_NULL_DEFINITION, TAG_DEFINITION];
2197+
}
2198+
return;
2199+
}
21932200
if (this.referencedPersistedDirectiveNames.has(SEMANTIC_NON_NULL)) {
2194-
this.routerDefinitions.push(SEMANTIC_NON_NULL_DEFINITION);
21952201
this.clientDefinitions.push(SEMANTIC_NON_NULL_DEFINITION);
2196-
}
2197-
if (!this.isVersionTwo) {
2202+
this.routerDefinitions = [
2203+
AUTHENTICATED_DEFINITION,
2204+
DEPRECATED_DEFINITION,
2205+
INACCESSIBLE_DEFINITION,
2206+
REQUIRES_SCOPES_DEFINITION,
2207+
SEMANTIC_NON_NULL_DEFINITION,
2208+
SCOPE_SCALAR_DEFINITION,
2209+
TAG_DEFINITION,
2210+
];
21982211
return;
21992212
}
2200-
this.routerDefinitions.push(
2201-
...[AUTHENTICATED_DEFINITION, INACCESSIBLE_DEFINITION, REQUIRES_SCOPES_DEFINITION, SCOPE_SCALAR_DEFINITION],
2202-
);
2213+
this.routerDefinitions = [
2214+
AUTHENTICATED_DEFINITION,
2215+
DEPRECATED_DEFINITION,
2216+
INACCESSIBLE_DEFINITION,
2217+
REQUIRES_SCOPES_DEFINITION,
2218+
SCOPE_SCALAR_DEFINITION,
2219+
TAG_DEFINITION,
2220+
];
22032221
}
22042222

22052223
validatePathSegmentInaccessibility(path: string): boolean {

composition/src/v1/utils/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ export function isObjectDefinitionData(data?: ParentDefinitionData): data is Obj
446446

447447
export function getNodeCoords(data: NodeData): string {
448448
switch (data.kind) {
449+
case Kind.ARGUMENT:
450+
// Intentional fallthrough
449451
case Kind.FIELD_DEFINITION:
450452
// Intentional fallthrough
451453
case Kind.INPUT_VALUE_DEFINITION:

0 commit comments

Comments
 (0)