Skip to content
Open
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
23 changes: 0 additions & 23 deletions composition/src/v1/federation/federation-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
configureDescriptionPropagationError,
inaccessibleQueryRootTypeError,
inaccessibleRequiredInputValueError,
inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage,
incompatibleFederatedFieldNamedTypeError,
incompatibleMergedTypesError,
incompatibleParentKindFatalError,
Expand Down Expand Up @@ -2536,17 +2535,6 @@ export class FederationFactory {
return [];
}
let lastData: ParentDefinitionData = objectData;
if (this.inaccessibleCoords.has(lastData.renamedTypeName)) {
fieldErrorMessages.push(
inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage(
inputFieldPath,
conditionFieldPath,
paths[0],
lastData.renamedTypeName,
),
);
return [];
}
let partialConditionFieldPath = '';
for (let i = 0; i < paths.length; i++) {
const fieldName = paths[i];
Expand Down Expand Up @@ -2587,17 +2575,6 @@ export class FederationFactory {
);
return [];
}
if (this.inaccessibleCoords.has(fieldPath)) {
fieldErrorMessages.push(
inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage(
inputFieldPath,
conditionFieldPath,
partialConditionFieldPath,
fieldPath,
),
);
return [];
}
if (BASE_SCALARS.has(fieldData.namedTypeName)) {
lastData = { kind: Kind.SCALAR_TYPE_DEFINITION, name: fieldData.namedTypeName } as ScalarDefinitionData;
continue;
Expand Down
37 changes: 6 additions & 31 deletions composition/tests/v1/directives/subscription-filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { describe, expect, test } from 'vitest';
import {
CONDITION,
FIRST_ORDINAL,
inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage,
invalidArgumentValueErrorMessage,
invalidDirectiveError,
invalidEventDrivenGraphError,
Expand Down Expand Up @@ -404,27 +403,8 @@ describe('@openfed__subscriptionFilter tests', () => {
]);
});

test('that an error is returned if fieldPath references an inaccessible field', () => {
const result = federateSubgraphsFailure([subgraphB, subgraphN], ROUTER_COMPATIBILITY_VERSION_ONE);
expect(result.errors).toHaveLength(1);
expect(result.errors).toStrictEqual([
invalidSubscriptionFilterDirectiveError('Subscription.one', [
subscriptionFieldConditionInvalidInputFieldError(
'condition.IN',
[],
[],
[],
[
inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage(
'condition.IN.fieldPath',
'object.id',
'object.id',
'Object.id',
),
],
),
]),
]);
test('that inaccessible fields can be used as fieldPath reference', () => {
federateSubgraphsSuccess([subgraphR, subgraphN], ROUTER_COMPATIBILITY_VERSION_ONE);
});

test('that an error is if condition.AND or condition.OR contain no elements or more than 5 elements', () => {
Expand Down Expand Up @@ -927,19 +907,14 @@ const subgraphN: Subgraph = {
name: 'subgraph-n',
url: '',
definitions: parse(`
type Entity @key(fields: "id object { id }", resolvable: false) {
type Entity @key(fields: "id", resolvable: false) @key(fields: "name", resolvable: false) {
id: ID! @external
object: Object! @external
}

type Object {
id: ID! @external @inaccessible
name: String! @external @inaccessible
}

type Subscription {
one: Entity! @edfs__kafkaSubscribe(topics: ["employeeUpdated"]) @openfed__subscriptionFilter(condition: { IN: { fieldPath: "object.id", values: [1], } })
}
`),
one: Entity! @edfs__kafkaSubscribe(topics: ["employeeUpdated"]) @openfed__subscriptionFilter(condition: { IN: { fieldPath: "name", values: ["test"], } })
}`),
};

const subgraphO: Subgraph = {
Expand Down
Loading