Skip to content

Commit 3dc075f

Browse files
committed
person_ops.gql: move @check to a field with no side effects.
Adding `@check` to a field with side effects became illegal since cl/756896487. The fix in this commit adds a "query" field (which has no side effects) and, instead, attaches the `@check` directive to that. This fixes the following 2 test failures in `OperationExecutionErrorsIntegrationTest`: * `executeMutationFailsWithNonNullDataNonEmptyErrorsDecodingSucceeds` * `executeMutationFailsWithNonNullDataNonEmptyErrorsDecodingFails` The test failures looked like this: ``` io.kotest.assertions.MultiAssertionError: The following 2 assertions failed: 1) exception.message "operation encountered errors during execution: [mutation.createPersonWithPartialFailure.person2: @check is disallowed on side-effect fields unless the operation has @transaction]" should contain the substring "ecxpjy4qfy" with non-abutting text at com.google.firebase.dataconnect.testutil.TestUtilsKt.shouldContainWithNonAbuttingText(TestUtils.kt:79) 2) exception.response.rawData Expected [("person1", [("id", "com.google.firebase.dataconnect.OperationExecutionErrorsIntegrationTest.executeMutationFailsWithNonNullDataNonEmptyErrorsDecodingFails_vNGzY61U2l3DkpBiK4s1")]), ("person2", <null>)] but actual was null at com.google.firebase.dataconnect.testutil.DataConnectOperationExceptionTestUtilsKt.shouldSatisfy(DataConnectOperationExceptionTestUtils.kt:74) at com.google.firebase.dataconnect.testutil.DataConnectOperationExceptionTestUtilsKt.shouldSatisfy(DataConnectOperationExceptionTestUtils.kt:266) at com.google.firebase.dataconnect.OperationExecutionErrorsIntegrationTest$executeMutationFailsWithNonNullDataNonEmptyErrorsDecodingFails$1.invokeSuspend(OperationExecutionErrorsIntegrationTest.kt:224) ```
1 parent 23d1b98 commit 3dc075f

File tree

1 file changed

+2
-1
lines changed
  • firebase-dataconnect/emulator/dataconnect/connector/person

1 file changed

+2
-1
lines changed

firebase-dataconnect/emulator/dataconnect/connector/person/person_ops.gql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ query getPersonWithPartialFailure($id: String!) @auth(level: PUBLIC) {
9696

9797
mutation createPersonWithPartialFailure($id: String!, $name: String!) @auth(level: PUBLIC) {
9898
person1: person_insert(data: { id: $id, name: $name })
99-
person2: person_insert(data: { id_expr: "uuidV4()", name: $name }) @check(expr: "false", message: "ecxpjy4qfy")
99+
query @redact { person(id: $id) { id @check(expr: "false", message: "ecxpjy4qfy") } }
100+
person2: person_insert(data: { id_expr: "uuidV4()", name: $name })
100101
}
101102

0 commit comments

Comments
 (0)