Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add locations to composition errors #686

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
da811fd
1. move all error tests into describe('error'...,
mayakoneval Apr 21, 2021
0e9cb22
EXTENSION_OF_WRONG_KIND pass extension node to errorWithCode to get l…
mayakoneval Apr 22, 2021
5b68ef1
EXTENSION_WITH_NO_BASE pass extension node to errorWithCode to get lo…
mayakoneval Apr 22, 2021
cbb8296
KEY_FIELDS_SELECT_INVALID_TYPE add field node to errorWithCode to get…
mayakoneval Apr 22, 2021
cd4971d
KEY_FIELDS_MISSING_ON_BASE add field node on errorWithCode to get loc…
mayakoneval Apr 22, 2021
965b73a
KEY_FIELDS_MISSING_EXTERNAL add field node or parent node on errorWit…
mayakoneval Apr 22, 2021
321e8ca
KEY_MISSING_ON_BASE add parent node to errorWithCode to get location …
mayakoneval Apr 22, 2021
594baa6
MULTIPLE_KEYS_ON_EXTENSION add parentType node to errorWithCode to ge…
mayakoneval Apr 22, 2021
5542820
KEY_NOT_SPECIFIED add parent type node to errorWithCode to get locati…
mayakoneval Apr 22, 2021
c820bfe
EXTERNAL_UNUSED add field node to errorWithCode to get locations & up…
mayakoneval Apr 22, 2021
d702a35
EXTERNAL_TYPE_MISMATCH add external field node to get locations & upd…
mayakoneval Apr 22, 2021
e7d11d9
EXTERNAL_MISSING_ON_BASE add external field node on errorWithCode to …
mayakoneval Apr 22, 2021
ed1d413
EXTERNAL_USED_ON_BASE add field node to errorWithCode to get location…
mayakoneval Apr 22, 2021
6cdff46
PROVIDES_FIELDS_MISSING_EXTERNAL add field astnode to errorWithCode t…
mayakoneval Apr 22, 2021
2003802
PROVIDES_NOT_ON_ENTITY add field ast node on errorWithCode to get loc…
mayakoneval Apr 22, 2021
a88b5e8
PROVIDES_FIELDS_SELECT_INVALID_TYPE add field ast node on errorWithCo…
mayakoneval Apr 22, 2021
24cf587
REQUIRES_FIELDS_MISSING_EXTERNAL add field ast node to errorWithCode …
mayakoneval Apr 22, 2021
f9ab2ca
REQUIRES_FIELDS_MISSING_ON_BASE add field astnode to errorWithCode to…
mayakoneval Apr 22, 2021
951dc97
REQUIRES_USED_ON_BASE add field node to errorWithCode to get location…
mayakoneval Apr 22, 2021
ae74390
EXECUTABLE_DIRECTIVES_IN_ALL_SERVICES add directive node to errorWith…
mayakoneval Apr 22, 2021
0858b2f
EXECUTABLE_DIRECTIVES_IDENTICAL add directive node to errorWithCode t…
mayakoneval Apr 22, 2021
c77733f
DUPLICATE_SCALAR_DEFINITION add duplicate scalar node to errorWithCod…
mayakoneval Apr 22, 2021
47a4495
DUPLICATE_ENUM_DEFINITION add duplicate enum definition to errorWithC…
mayakoneval Apr 22, 2021
4d4c862
DUPLICATE_ENUM_VALUE add enum type def / extension node to errorWithC…
mayakoneval Apr 22, 2021
45740f8
ENUM_MISMATCH & ENUM_MISMATCH_TYPE - add enum type node to errorsWith…
mayakoneval Apr 22, 2021
0b79f14
RESERVED_FIELD_USED add field node to errorWithCode to get locations …
mayakoneval Apr 22, 2021
1a6b1d7
ROOT_QUERY_USED ROOT_MUTATION_USED ROOT_SUBSCRIPTION_USED add node to…
mayakoneval Apr 22, 2021
b23a9f7
VALUE_TYPE_FIELD_TYPE_MISMATCH nodes were already passed, both subgra…
mayakoneval Apr 22, 2021
1cbfa5f
VALUE_TYPE_INPUT_VALUE_MISMATCH nodes were already passed to errorWit…
mayakoneval Apr 22, 2021
586a3fe
VALUE_TYPE_NO_ENTITY already passed 2 nodes to errorWithCode = locati…
mayakoneval Apr 22, 2021
4b839f9
VALUE_TYPE_UNION_TYPES_MISMATCH nodes already passed = 2 locations, o…
mayakoneval Apr 22, 2021
b720ded
VALUE_TYPE_KIND_MISMATCH passed both subgraph nodes, so location show…
mayakoneval Apr 22, 2021
a212a3e
MISSING_ERROR edit remaining composeAndValidate errors using parse
mayakoneval Apr 22, 2021
d4eb5e8
update compose.test.ts with locations & graphqlErrorSerializer
mayakoneval Apr 22, 2021
b806b4c
expose all locations for ENUM_MISMATCH errors, rather than only the f…
mayakoneval Apr 27, 2021
5792613
install strip-indent
mayakoneval Apr 27, 2021
d218980
write test util function gql with parse and strip indent
mayakoneval Apr 27, 2021
0037abc
gql args - not sure if we need this so put it in a new commit
mayakoneval Apr 27, 2021
b9d3adc
compose & composeAndValidate - parse & gql uses -> new gql test util …
mayakoneval Apr 27, 2021
c787920
executableDirectivesIdentical - parse & gql uses -> new gql test util…
mayakoneval Apr 27, 2021
a0bc39d
executableDirectivesInAllServices.test.ts - parse & gql uses -> new …
mayakoneval Apr 27, 2021
00e8eab
externalMissingOnBase.test.ts - parse & gql uses -> new gql test uti…
mayakoneval Apr 27, 2021
1a7499e
externalTypeMismatch.test.ts - parse & gql uses -> new gql test util…
mayakoneval Apr 27, 2021
4114f35
externalUnused.test.ts - parse & gql uses -> new gql test util alias…
mayakoneval Apr 27, 2021
11f64ec
keyFieldsMissingOnBase.test.ts - parse & gql uses -> new gql test u…
mayakoneval Apr 27, 2021
f61b626
keyFieldsSelectInvalidType.test.ts - parse & gql uses -> new gql test…
mayakoneval Apr 27, 2021
162a90a
keysMatchBaseService.test.ts - parse & gql uses -> new gql test util…
mayakoneval Apr 27, 2021
d2731ff
providesFieldsMissingExternals.test.ts - parse & gql uses -> new gql …
mayakoneval Apr 27, 2021
300b426
providesFieldsSelectInvalidType.test.ts - parse & gql uses -> new gql…
mayakoneval Apr 27, 2021
64246b5
providesNotOnEntity.test.ts - parse & gql uses -> new gql test util a…
mayakoneval Apr 27, 2021
b6e7cf6
requiresFieldsMissingExternals.test.ts - parse & gql uses -> new gql…
mayakoneval Apr 27, 2021
b2f6a19
requiresFieldsMissingOnBase.test.ts - parse & gql uses -> new gql tes…
mayakoneval Apr 27, 2021
b715495
duplicateEnumOrScalar.test.ts - parse & gql uses -> new gql test util…
mayakoneval Apr 27, 2021
513ca04
duplicateEnumValue.test.ts - parse & gql uses -> new gql test util al…
mayakoneval Apr 27, 2021
665ff7e
externalUsedOnBase.test.ts - parse & gql uses -> new gql test util al…
mayakoneval Apr 27, 2021
d3a7b9d
keyFieldsMissingExternal.test.ts - parse & gql uses -> new gql test u…
mayakoneval Apr 27, 2021
d7ec439
requiresUsedOnBase.test.ts - parse & gql uses -> new gql test util al…
mayakoneval Apr 27, 2021
615b267
reservedFieldUsed.test.ts - parse & gql uses -> new gql test util ali…
mayakoneval Apr 27, 2021
037237a
rootFieldUsed.test.ts - parse & gql uses -> new gql test util alias &…
mayakoneval Apr 27, 2021
8181e38
matchingEnums.test.ts - parse & gql uses -> new gql test util alias &…
mayakoneval Apr 27, 2021
0f699ee
matchingUnions.test.ts - parse & gql uses -> new gql test util alias …
mayakoneval Apr 27, 2021
2e895f2
possibleTypeExtensions.test.ts - parse & gql uses -> new gql test uti…
mayakoneval Apr 27, 2021
da7c660
uniqueTypeNamesWithFields.test.ts - parse & gql uses -> new gql test …
mayakoneval Apr 27, 2021
40ad8a6
|| undefined -> ?? undefined
mayakoneval Apr 27, 2021
e0fd417
update CHANGELOG.md
mayakoneval Apr 27, 2021
73fe00d
Update federation-js/CHANGELOG.md
mayakoneval Apr 28, 2021
d8353b5
Update federation-integration-testsuite-js/src/utils/gql.ts
abernix Apr 29, 2021
fbbc85e
Merge branch 'main' into maya/composition-errors-locations
abernix Apr 29, 2021
b1bceb1
location on selection set errors should match the field node, not the…
mayakoneval Apr 29, 2021
42dfbbd
use location of type reflected in error message rather than field in …
mayakoneval Apr 30, 2021
9b8bb34
VALUE_TYPE_FIELD_TYPE_MISMATCH -> select the field instead of the who…
mayakoneval May 5, 2021
d180c03
add node for each service that defines a given directive in EXECUTABL…
mayakoneval May 5, 2021
7f3a668
more specific locations in externalTypeMismatch & externalUnused
mayakoneval May 5, 2021
af5776d
select the key directive on keyFieldsMissingOnBase
mayakoneval May 5, 2021
3b75ff3
providesFieldsMissingExternals points to the actionable field that is…
mayakoneval May 5, 2021
4de9a8d
select fields on provides directive in providesFieldsSelectInvalidType
mayakoneval May 5, 2021
f928596
providesNotOnEntity location is on provides directive
mayakoneval May 5, 2021
bdd5592
requiresfieldsmissingexternals more specific location. TODO: update s…
mayakoneval May 5, 2021
e364771
requiresFieldsMissingOnBase point to the fields arg on the requires d…
mayakoneval May 5, 2021
0a1e203
add comments to come back to when issue #705 is addressed
mayakoneval May 5, 2021
65a6cc6
externalUsedOnBase more specific location -> to the @external directive
mayakoneval May 5, 2021
c640914
requiresUsedOnBase - more specific -> requires directive
mayakoneval May 5, 2021
8b638e8
duplicateEnumValue error location is on the duplicate value rather th…
mayakoneval May 5, 2021
ae3e2ca
uniqueTypeNamesWithFields points to return types
mayakoneval May 5, 2021
fcb15c4
another comment
mayakoneval May 5, 2021
4a94b78
pass accurate nodes & update the error message to match for uniqueFie…
mayakoneval May 5, 2021
8eda3db
point to only the external directive on externalUnused, externalMisma…
mayakoneval May 7, 2021
a79ae16
point to the selection set on the @key errors
mayakoneval May 7, 2021
0ac045d
make the provides errors more specfic to the selection set, or less s…
mayakoneval May 7, 2021
0e4302e
make requires errors more specific to the selection set
mayakoneval May 7, 2021
0b5a188
search for selection set by whole printed selection set, rather than …
mayakoneval May 7, 2021
606a341
use printFieldSet from utils all over, change includes to === in find…
mayakoneval May 10, 2021
463c8f9
Merge branch 'main' into maya/composition-errors-locations
trevor-scheer May 10, 2021
d34729e
Remove unused imports
trevor-scheer May 10, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('validateExternalDirectivesOnSchema', () => {
"code": "EXTERNAL_TYPE_MISMATCH",
"locations": Array [
mayakoneval marked this conversation as resolved.
Show resolved Hide resolved
Object {
"column": 3,
"column": 8,
"line": 3,
},
],
Expand All @@ -50,7 +50,7 @@ describe('validateExternalDirectivesOnSchema', () => {
"code": "EXTERNAL_TYPE_MISMATCH",
"locations": Array [
Object {
"column": 3,
"column": 9,
"line": 4,
},
],
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('validateExternalDirectivesOnSchema', () => {
"code": "EXTERNAL_TYPE_MISMATCH",
"locations": Array [
Object {
"column": 3,
"column": 8,
"line": 3,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('externalUnused', () => {
"code": "EXTERNAL_UNUSED",
"locations": Array [
mayakoneval marked this conversation as resolved.
Show resolved Hide resolved
Object {
"column": 3,
"column": 16,
"line": 3,
},
],
Expand Down Expand Up @@ -382,7 +382,7 @@ describe('externalUnused', () => {
"code": "EXTERNAL_UNUSED",
"locations": Array [
Object {
"column": 3,
"column": 18,
"line": 5,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const externalTypeMismatch: PostCompositionValidator = ({ schema }) => {
'EXTERNAL_TYPE_MISMATCH',
logServiceAndType(serviceName, typeName, externalFieldName) +
`the type of the @external field does not exist in the resulting composed schema`,
externalField,
externalField.type,
),
);
} else if (
Expand All @@ -54,7 +54,7 @@ export const externalTypeMismatch: PostCompositionValidator = ({ schema }) => {
'EXTERNAL_TYPE_MISMATCH',
logServiceAndType(serviceName, typeName, externalFieldName) +
`Type \`${externalFieldType}\` does not match the type of the original field in ${typeFederationMetadata.serviceName} (\`${matchingBaseField.type}\`)`,
externalField,
externalField.type,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const externalUnused: PostCompositionValidator = ({ schema }) => {
externalFieldName,
) +
`is marked as @external but is not used by a @requires, @key, or @provides directive.`,
externalField,
externalField.directives,
mayakoneval marked this conversation as resolved.
Show resolved Hide resolved
),
);
}
Expand Down