Validateable trait doesn't enforce subclass's constraints
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
Given a base class (not a domain class) that implements the `Validateable` trait, and a subclass that extends the base class and adds it's own constraints, only the constraints in the base class are enforced.
Interestingly, this is not the case in unit tests - everything works fine there. But in integration tests or actual application code, this issue seems to be pretty consistent. I've created a sample app at https://github.com/ZacharyKlein/validateable-subclass that demonstrates the problem in an integration test (`EmployerIntegrationSpec`) and a controller (`EmployerSpec`). A unit test (`EmployerSpec`), which passes without showing the problem, is also included.
Contributor guide
Research direction
Start with the sample app's EmployerIntegrationSpec, controller EmployerSpec, and passing unit EmployerSpec, comparing how Validateable constraints are applied in each context. Trace the integration and application validation path until the subclass constraints are included, then confirm the behavior in both integration and controller tests without breaking the unit test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100