Add option to validate entities loaded from a file by Fixtures.load
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
play framework |
New
|
Undecided
|
Unassigned |
Bug Description
Currently Fixtures.load will take in entities from a given file as-is. This means that entities which may normally not validate are loaded into the database. This is a problem because (at least for me) it's fairly easy for me to forget a line for an entity, and I'd like to know at the time it's loaded I oopsed, not when one of my app pages blows up because a required field was null.
Therefore I've attached a patch that validates an entity after it is loaded and throws an error containing the entity type, id, and error messages if it fails. Considering that not everyone might want this and for backwards compatibility, this feature does not run by default and can be turned on by putting "fixtures.
As to my patch, if there's a better way within Play! of figuring out whether a conf-file value is true, please feel free to change that. I couldn't see a nice way other than simple String comparison as the closest solution would have been getBoolean(