The GitHub Actions job "CI - Groovy Joint Validation Build" on 
grails-core.git/nullable-by-default has succeeded.
Run started by GitHub user codeconsole (triggered by codeconsole).

Head commit for run:
c27b930c005f7025aec625228460b0aed1377d5e / Scott Murphy Heiberg 
<[email protected]>
Make domain properties nullable by default (Grails 8)

Flip GORM's validation default so an unconstrained persistent (domain) property 
is nullable
unless explicitly constrained, aligning Grails with the rest of the JVM 
persistence/validation
ecosystem (JPA/Hibernate, Spring Data JPA & MongoDB, Micronaut Data, Jakarta 
Bean Validation),
all of which treat an unconstrained property as valid-when-null.

The default is controlled by a new YAML-friendly boolean, defaulting to 
nullable-by-default:

    grails.gorm.default.nullable = false   # restore legacy required-by-default

This is wired through DefaultConstraintEvaluator (new defaultNullable, default 
true), surfaced as
ConnectionSourceSettings.DefaultSettings.nullable, and read on both 
validator-construction paths
(DefaultValidatorRegistry for the GORM datastore and 
DefaultConstraintEvaluatorFactoryBean for
Grails domain classes). The existing closure form also still works:

    grails.gorm.default.constraints = { '*'(nullable: false) }

Scope notes:
- Validation layer only. Command-object validation 
(Validateable.defaultNullable()) is intentionally
  left required-by-default and unchanged.
- Column/DDL nullability is governed separately by the mapping layer 
(Property.nullable /
  GrailsDomainBinder) and is not changed here; aligning the DDL default is a 
documented follow-up.

Tests: existing specs that assert required-by-default semantics are updated to 
declare the field(s)
they depend on explicitly (nullable: false), reproducing the prior baseline for 
just those fields
rather than disabling the new default wholesale. Notes:
- grails-test-suite-uber DomainConstraintGettersSpec restores 
required-by-default for its own
  context via a per-spec doWithConfig override, since it exists to verify 
default-constraint
  enumeration via the nullable error.
- FindOrCreateWhereSpec (mongodb) was using the wrong Person class (a 
same-package collision); it
  now imports grails.gorm.tests.Person to match Pet.owner.
- New NullableByDefaultSpec demonstrates the new default without any opt-out, 
and verifies that
  grails.gorm.default.nullable = false restores required-by-default through 
DefaultValidatorRegistry.
- The example-app functional/integration suites assert required-by-default 
app-wide, so each opts out
  with grails.gorm.default.nullable = false in its application.yml (the flag's 
intended use).

Docs: the nullable constraint reference now documents the new default and the
grails.gorm.default.nullable flag (YAML and groovy forms).

Report URL: https://github.com/apache/grails-core/actions/runs/27160397575

With regards,
GitHub Actions via GitBox

Reply via email to