You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add new optional `label` arg to `@override` which is a `String`.
Capture label in the supergraph via the new `@join__field` arg
`overrideLabel` so these values can be used during query graph creation
and query planning.
- cannot move to subgraph "Subgraph1" using @key(fields: "k") of "T", the key field(s) cannot be resolved from subgraph "Subgraph2" (note that some of those key fields are overridden in "Subgraph2").
`Invalid @override label "${value}" on field "T.a" on subgraph "invalidLabel": labels must start with a letter and after that may contain alphanumerics, underscores, minuses, colons, periods, or slashes. Alternatively, labels may be of the form "percent(x)" where x is a float between 0-100 inclusive.`,
1035
+
]);
1036
+
}
1037
+
);
1038
+
1039
+
it.each(["0.5","1","1.0","99.9"])(
1040
+
"allows valid percent-based labels",
1041
+
(value)=>{
1042
+
constwithPercentLabel={
1043
+
name: "percentLabel",
1044
+
url: "https://percentLabel",
1045
+
typeDefs: gql`
1046
+
type Query {
1047
+
t: T
1048
+
}
1049
+
1050
+
type T @key(fields: "k") {
1051
+
k: ID
1052
+
a: Int @override(from: "overridden", label: "percent(${value})")
a: Int @override(from: "overridden", label: "percent(${value})")
1076
+
}
1077
+
`,
1078
+
};
1079
+
1080
+
constresult=composeAsFed2Subgraphs([
1081
+
withInvalidPercentLabel,
1082
+
overridden,
1083
+
]);
1084
+
expect(errors(result)).toContainEqual([
1085
+
"OVERRIDE_LABEL_INVALID",
1086
+
`Invalid @override label "percent(${value})" on field "T.a" on subgraph "invalidPercentLabel": labels must start with a letter and after that may contain alphanumerics, underscores, minuses, colons, periods, or slashes. Alternatively, labels may be of the form "percent(x)" where x is a float between 0-100 inclusive.`,
`Invalid @override label "${overrideLabel}" on field "${dest.coordinate}" on subgraph "${subgraphName}": labels must start with a letter and after that may contain alphanumerics, underscores, minuses, colons, periods, or slashes. Alternatively, labels may be of the form "percent(x)" where x is a float between 0-100 inclusive.`,
Copy file name to clipboardExpand all lines: docs/source/errors.md
+1
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,7 @@ The following errors might be raised during composition:
65
65
|`ONLY_INACCESSIBLE_CHILDREN`| A type visible in the API schema has only @inaccessible children. | 2.0.0 ||
66
66
|`OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE`| The @override directive cannot be used on external fields, nor to override fields with either @external, @provides, or @requires. | 2.0.0 ||
67
67
|`OVERRIDE_FROM_SELF_ERROR`| Field with `@override` directive has "from" location that references its own subgraph. | 2.0.0 ||
68
+
|`OVERRIDE_LABEL_INVALID`| The @override directive `label` argument must match the pattern /^[a-zA-Z][a-zA-Z0-9_-:./]*$/ or /^percent((d{1,2}(.d{1,8})?|100))$/ | 2.7.0 ||
68
69
|`OVERRIDE_ON_INTERFACE`| The @override directive cannot be used on the fields of an interface type. | 2.3.0 ||
69
70
|`OVERRIDE_SOURCE_HAS_OVERRIDE`| Field which is overridden to another subgraph is also marked @override. | 2.0.0 ||
70
71
|`PROVIDES_DIRECTIVE_IN_FIELDS_ARG`| The `fields` argument of a `@provides` directive includes some directive applications. This is not supported | 2.1.0 ||
0 commit comments