Open
Description
Task List
- Steps to reproduce provided
- Example that reproduces the problem uploaded to Github
- Full description of the issue provided (see below)
Steps to Reproduce
- Clone the example repo:
https://github.com/rmorrise/grails-unique-child grails run-app
- POST the following JSON data:
http://localhost:8080/MasterThing
Content-Type application/json
{
"details": [
{
"itemName": "Foo"
}
]
}
- Repeat the same POST request again.
Expected Behaviour
Both requests should be OK.
Validation of the unique
constraint on DetailItem
should be scoped to the master object that is being posted.
Actual Behaviour
HTTP error 422:
Property [itemName] of class [class grails.unique.child.DetailItem] with value [Foo] must be unique
The unique
constraint is validated globally for the itemName
properly only.
Environment Information
- Operating System: Windows 7 x64
- GORM Version: 6.1.10.RELEASE
- Grails Version (if using Grails): 3.3.8
- JDK Version: 1.8.0_121