Skip to content

Transient properties validated two times #10347

@skorikovdm

Description

@skorikovdm

GrailsDomainClassValidator.java was refactored in grails 3 (and 2) and it seems that now there is an error in validate method:
In grails 1 validate method validates persistent properties first, and all properties except persistent after.
In grails 3 validate method validates all properties, and all properties except persistent after.

This results in calling validators on transient fields two times during object validation

Steps to Reproduce

  1. Create new domain class
  2. Add transient field to this class
  3. Add custom validator to this field
  4. Add some output (println) from custom validator
  5. Call validate method on object of this class
  6. Check the output

Expected Behaviour

Custom validator called one time for one validate call

Actual Behaviour

Custom validator called two times for one validate call

Example Application

https://github.com/skorikovdm/GrailsValidationErrorExample

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions