Copilot commented on code in PR #16136:
URL: https://github.com/apache/grails-core/pull/16136#discussion_r3767860190
##########
grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/config/AbstractGormMappingFactory.java:
##########
@@ -54,6 +54,7 @@ public abstract class AbstractGormMappingFactory<R extends
Entity, T extends Pro
private Object contextObject;
protected Closure defaultConstraints;
protected boolean versionByDefault = true;
+ protected boolean defaultNullable = false;
Review Comment:
`defaultNullable` is initialized to `false`, but
`ConnectionSourceSettings.DefaultSettings.nullable` defaults to `true` (Grails
8 nullable-by-default). Any `AbstractGormMappingFactory` usage that doesn’t
call `setDefaultNullable(...)` (e.g. Document/KeyValue/Neo4j mapping contexts)
will continue generating non-nullable mapped forms by default, recreating the
validation-vs-schema mismatch this PR is addressing.
##########
grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy:
##########
@@ -104,13 +98,10 @@ class UserIntegrationSpec extends Specification implements
GraphQLSpec {
}
}
""")
- Map obj = resp.body
+ Map obj = resp.body
Review Comment:
Extra spacing in the variable declaration looks accidental and deviates from
the surrounding style.
##########
grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy:
##########
@@ -53,10 +53,7 @@ class UserIntegrationSpec extends Specification implements
GraphQLSpec {
Map obj = resp.body
then:
- obj.data == null
- obj.errors.size() == 1
- obj.errors[0].message.startsWith('Validation error
(WrongType@[userCreate])')
- obj.errors[0].message.endsWith("is missing required fields
'[profile]'")
+ obj.data.userCreate != null
Review Comment:
This assertion no longer verifies the behavior implied by the test name
(missing required `profile` should fail). As written, the test will pass even
if the mutation returns GraphQL errors (or creates a user unexpectedly). Please
assert that the mutation is rejected (e.g. `userCreate` is null and `errors`
mentions `profile`), or rename/rework the test to actually validate successful
creation.
This issue also appears in the following locations of the same file:
- line 80
- line 103
- line 128
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]