Skip to content

Commit ee51df6

Browse files
janettecmeta-codesync[bot]
authored andcommitted
Add actionable guidance to plugin-socket dependency and field argument conflict error messages
Reviewed By: mjmahone Differential Revision: D94953872 fbshipit-source-id: 656d7d490d7346c294d7bf63cde9a57fd860d96d
1 parent 53ac7e1 commit ee51df6

15 files changed

Lines changed: 16 additions & 15 deletions

compiler/crates/graphql-ir-validations/src/validate_selection_conflict.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ enum ValidationMessage {
642642
},
643643

644644
#[error(
645-
"Expected all fields on the same parent with the name or alias `{field_name}` to have the same argument values after applying fragment arguments. This field has the applied argument values: {arguments_a}"
645+
"Expected all fields on the same parent with the name or alias `{field_name}` to have the same argument values after applying fragment arguments. This field has the applied argument values: {arguments_a}. \
646+
If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: {field_name}(...)`."
646647
)]
647648
InvalidSameFieldWithDifferentArguments {
648649
field_name: StringKey,

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/client-fields-overlapping-error.invalid.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extend type Query {
1212
client_field(arg: String): String
1313
}
1414
==================================== ERROR ====================================
15-
✖︎ Expected all fields on the same parent with the name or alias `client_field` to have the same argument values after applying fragment arguments. This field has the applied argument values: (arg: "Value1")
15+
✖︎ Expected all fields on the same parent with the name or alias `client_field` to have the same argument values after applying fragment arguments. This field has the applied argument values: (arg: "Value1"). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: client_field(...)`.
1616

1717
client-fields-overlapping-error.invalid.graphql:4:3
1818
3 │ query clientFieldsOverlappingErrorQuery {

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/conflicting-selections-with-actor-change.invalid.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fragment conflictingSelectionsWithActorChange3_fragment on Query {
2222
}
2323
}
2424
==================================== ERROR ====================================
25-
✖︎ Expected all fields on the same parent with the name or alias `username` to have the same argument values after applying fragment arguments. This field has the applied argument values: (name: "Alice")
25+
✖︎ Expected all fields on the same parent with the name or alias `username` to have the same argument values after applying fragment arguments. This field has the applied argument values: (name: "Alice"). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: username(...)`.
2626

2727
conflicting-selections-with-actor-change.invalid.graphql:13:3
2828
12 │ fragment conflictingSelectionsWithActorChange2_fragment on Query {

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/conflicting-selections-with-defer.invalid.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ query conflictingSelectionsWithDeferQuery {
2222
...conflictingSelectionsWithDefer2_fragment @defer
2323
}
2424
==================================== ERROR ====================================
25-
✖︎ Expected all fields on the same parent with the name or alias `node` to have the same argument values after applying fragment arguments. This field has the applied argument values: (id: 4)
25+
✖︎ Expected all fields on the same parent with the name or alias `node` to have the same argument values after applying fragment arguments. This field has the applied argument values: (id: 4). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: node(...)`.
2626

2727
conflicting-selections-with-defer.invalid.graphql:4:3
2828
3 │ fragment conflictingSelectionsWithDefer1_fragment on Query {

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/conflicting-selections-with-no-inline.invalid.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ query conflictingSelectionsWithNoInlineQuery {
1919
}
2020
}
2121
==================================== ERROR ====================================
22-
✖︎ Expected all fields on the same parent with the name or alias `node` to have the same argument values after applying fragment arguments. This field has the applied argument values: (id: 4)
22+
✖︎ Expected all fields on the same parent with the name or alias `node` to have the same argument values after applying fragment arguments. This field has the applied argument values: (id: 4). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: node(...)`.
2323

2424
conflicting-selections-with-no-inline.invalid.graphql:4:3
2525
3 │ fragment conflictingSelectionsWithNoInline_fragment on Query @no_inline {

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/fragment-with-defer-arguments-without-label.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fragment fragmentWithDeferArgumentsWithoutLabel_DeferredFragment on User @argume
2323
}
2424
}
2525
==================================== ERROR ====================================
26-
✖︎ Expected all fields on the same parent with the name or alias `profile_picture` to have the same argument values after applying fragment arguments. This field has the applied argument values: (scale: 1.5)
26+
✖︎ Expected all fields on the same parent with the name or alias `profile_picture` to have the same argument values after applying fragment arguments. This field has the applied argument values: (scale: 1.5). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: profile_picture(...)`.
2727

2828
fragment-with-defer-arguments-without-label.graphql:20:3
2929
19 │ name

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/relay-resolver-with-args-and-alias.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extend type User {
2323
pop_star_name(scale: Float!): String @relay_resolver(fragment_name: "relayResolverWithArgsAndAlias_PopStarNameResolverFragment_name", import_path: "./path/to/PopStarNameResolver.js")
2424
}
2525
==================================== ERROR ====================================
26-
✖︎ Expected all fields on the same parent with the name or alias `profile_picture` to have the same argument values after applying fragment arguments. This field has the applied argument values: (scale: 1.5)
26+
✖︎ Expected all fields on the same parent with the name or alias `profile_picture` to have the same argument values after applying fragment arguments. This field has the applied argument values: (scale: 1.5). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: profile_picture(...)`.
2727

2828
relay-resolver-with-args-and-alias.graphql:5:3
2929
4 │ name

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/same-fields-with-different-args.invalid.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fragment sameFieldsWithDifferentArgs_NestedFragment2 on User {
1919
firstName(if: false, unless: false)
2020
}
2121
==================================== ERROR ====================================
22-
✖︎ Expected all fields on the same parent with the name or alias `firstName` to have the same argument values after applying fragment arguments. This field has the applied argument values: (if: false, unless: true)
22+
✖︎ Expected all fields on the same parent with the name or alias `firstName` to have the same argument values after applying fragment arguments. This field has the applied argument values: (if: false, unless: true). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: firstName(...)`.
2323

2424
same-fields-with-different-args.invalid.graphql:14:3
2525
13 │ fragment sameFieldsWithDifferentArgs_NestedFragment on User {

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/same_fields_with_different_args_variables.invalid.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fragment sameFieldsWithDifferentArgsVariablesFragment on User @argumentDefinitio
1515
url(site: $arg)
1616
}
1717
==================================== ERROR ====================================
18-
✖︎ Expected all fields on the same parent with the name or alias `url` to have the same argument values after applying fragment arguments. This field has the applied argument values: (site: "A")
18+
✖︎ Expected all fields on the same parent with the name or alias `url` to have the same argument values after applying fragment arguments. This field has the applied argument values: (site: "A"). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: url(...)`.
1919

2020
same_fields_with_different_args_variables.invalid.graphql:14:3
2121
13 │ ) {

compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/selection_set_conflict_added_argument.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ query selectionSetConflictAddedArgumentQuery {
1111
}
1212
}
1313
==================================== ERROR ====================================
14-
✖︎ Expected all fields on the same parent with the name or alias `profile_picture` to have the same argument values after applying fragment arguments. This field has the applied argument values: (scale: 1.5)
14+
✖︎ Expected all fields on the same parent with the name or alias `profile_picture` to have the same argument values after applying fragment arguments. This field has the applied argument values: (scale: 1.5). If the same field appears with different arguments, use an alias to distinguish them, e.g. `myAlias: profile_picture(...)`.
1515

1616
selection_set_conflict_added_argument.graphql:4:5
1717
3 │ me {

0 commit comments

Comments
 (0)