Skip to content

Commit ba1f054

Browse files
committed
fix: review comments
1 parent e137a0f commit ba1f054

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4353,10 +4353,7 @@ export class NormalizationFactory {
43534353
entityCaching.queryCacheConfigurations = [...(entityCaching.queryCacheConfigurations ?? []), config];
43544354
}
43554355

4356-
validateIsDirectivePlacement(fieldCoords: string, fieldData: FieldData, hasQueryCache: boolean) {
4357-
if (hasQueryCache) {
4358-
return;
4359-
}
4356+
validateIsDirectivePlacement(fieldCoords: string, fieldData: FieldData) {
43604357
for (const [argumentName, argumentData] of fieldData.argumentDataByName) {
43614358
if (!argumentData.directivesByName.has(OPENFED_IS)) {
43624359
continue;
@@ -5415,8 +5412,7 @@ export class NormalizationFactory {
54155412
// upsertParentsAndChildren and extractEntityCacheDirective, invalid keys pruned by
54165413
// evaluateExternalKeyFields), so queryCache can read keyFieldSetDatasByTypeName to build
54175414
// argument→key mappings.
5418-
const hasQueryCache = fieldData.directivesByName.has(OPENFED_QUERY_CACHE);
5419-
if (hasQueryCache) {
5415+
if (fieldData.directivesByName.has(OPENFED_QUERY_CACHE)) {
54205416
// A renamed root type (e.g. `schema { query: MyQuery }`) is keyed in configurationDataByTypeName
54215417
// under its federated/canonical name (Query/Mutation/Subscription) by every other config writer.
54225418
// Cache configs must use the same key, or the router reads the canonical node and never sees them.
@@ -5427,8 +5423,11 @@ export class NormalizationFactory {
54275423
fieldData,
54285424
this.getOperationTypeNodeForRootTypeName(parentTypeName),
54295425
);
5426+
} else {
5427+
// @openfed__is on an argument is only valid alongside @openfed__queryCache on the field, so any
5428+
// @openfed__is here (no queryCache) is a misplacement.
5429+
this.validateIsDirectivePlacement(`${parentTypeName}.${fieldName}`, fieldData);
54305430
}
5431-
this.validateIsDirectivePlacement(`${parentTypeName}.${fieldName}`, fieldData, hasQueryCache);
54325431
} else if (fieldData.externalFieldDataBySubgraphName.get(this.subgraphName)?.isDefinedExternal) {
54335432
externalInterfaceFieldNames.push(fieldName);
54345433
}

0 commit comments

Comments
 (0)