@theguild/federation-composition 0.6.1 → 0.6.2-rc-20231218160629-a5c68f9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,13 +38,15 @@ function validateDirectiveAgainstOriginal(providedDirectiveNode, directiveName,
38
38
  const isNonNullableString = providedType === 'String!';
39
39
  const allowedFieldSetTypes = isFederationV2
40
40
  ? ['FieldSet!', 'federation__FieldSet!', '_FieldSet!']
41
- : ['_FieldSet!', 'String'];
41
+ : ['_FieldSet!', 'String', 'String!'];
42
42
  const fieldSetTypesInSpec = isFederationV2
43
43
  ? ['FieldSet!', 'federation__FieldSet!', '_FieldSet!']
44
44
  : ['_FieldSet!', 'FieldSet!', 'String'];
45
45
  const expectsFieldSet = fieldSetTypesInSpec.includes(expectedType);
46
46
  if (!isNonNullableString && expectsFieldSet) {
47
- const isOneOfExpected = allowedFieldSetTypes.includes(providedType);
47
+ const isOneOfExpected = allowedFieldSetTypes
48
+ .concat(allowedFieldSetTypes.map(f => `[${f}]!`))
49
+ .includes(providedType);
48
50
  if (!isOneOfExpected) {
49
51
  errors.push(new graphql_1.GraphQLError(`Invalid definition for directive "@${directiveName}": argument "${argName}" should have type "${expectedType}" but found type "${providedType}"`, {
50
52
  nodes: providedDirectiveNode,
@@ -35,13 +35,15 @@ export function validateDirectiveAgainstOriginal(providedDirectiveNode, directiv
35
35
  const isNonNullableString = providedType === 'String!';
36
36
  const allowedFieldSetTypes = isFederationV2
37
37
  ? ['FieldSet!', 'federation__FieldSet!', '_FieldSet!']
38
- : ['_FieldSet!', 'String'];
38
+ : ['_FieldSet!', 'String', 'String!'];
39
39
  const fieldSetTypesInSpec = isFederationV2
40
40
  ? ['FieldSet!', 'federation__FieldSet!', '_FieldSet!']
41
41
  : ['_FieldSet!', 'FieldSet!', 'String'];
42
42
  const expectsFieldSet = fieldSetTypesInSpec.includes(expectedType);
43
43
  if (!isNonNullableString && expectsFieldSet) {
44
- const isOneOfExpected = allowedFieldSetTypes.includes(providedType);
44
+ const isOneOfExpected = allowedFieldSetTypes
45
+ .concat(allowedFieldSetTypes.map(f => `[${f}]!`))
46
+ .includes(providedType);
45
47
  if (!isOneOfExpected) {
46
48
  errors.push(new GraphQLError(`Invalid definition for directive "@${directiveName}": argument "${argName}" should have type "${expectedType}" but found type "${providedType}"`, {
47
49
  nodes: providedDirectiveNode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theguild/federation-composition",
3
- "version": "0.6.1",
3
+ "version": "0.6.2-rc-20231218160629-a5c68f9",
4
4
  "description": "Open Source Composition library for Apollo Federation",
5
5
  "peerDependencies": {
6
6
  "graphql": "^16.0.0"