Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gorm mongo doesn't failOnError when saving invalid nested objects #541

Open
stesteau opened this issue Jul 21, 2022 · 0 comments
Open

Gorm mongo doesn't failOnError when saving invalid nested objects #541

stesteau opened this issue Jul 21, 2022 · 0 comments

Comments

@stesteau
Copy link

stesteau commented Jul 21, 2022

@Entity
class Element implements Serializable {
	static mapWith = "mongo"
	Map<String,Video> videos = new HashMap<String,Video>()
	static embedded = ["videos"]
}

@Entity
class Video extends BaseTrack implements Serializable, Track {
	static mapWith = "mongo"
	Map<String,VideoChannel> channels = new HashMap<String,VideoChannel>() 
}

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant