Gorm mongo doesn't failOnError when saving invalid nested objects
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
```
@Entity
class Element implements Serializable {
static mapWith = "mongo"
Map videos = new HashMap()
static embedded = ["videos"]
}
@Entity
class Video extends BaseTrack implements Serializable, Track {
static mapWith = "mongo"
Map channels = new HashMap()
}
@Entity
class VideoChannel extends Channel implements Serializable {
static mapWith = "mongo"
String codec
static constraints = {
codec(nullable: false, inList: ['Uncompressed', 'H.264/MPEG-4 AVC-Intra 100'])
}
}
element.videos['bleh'].channels['bleh].codec = "Bullocks"
element.save(flush:true, failOnError:true)
```
Saving Element pass without error, it doesn't validate nested objects.
If I try to save the channel I have the expected «grails.validation.ValidationException: Validation error occurred during call to save():»
Adding deepValidation doesn't work either...
Context :
Grails : 5.x
GORM : 7.3.0
Contributor guide
Assessment
This issue has not been assessed yet.