Improvement suggestion: Error message when Embeddable has a missing field #3254
Labels
info: good first issue
Good for newcomers
type: improvement
A minor improvement to an existing feature
Issue description
Hi there!
I would like to suggest an improvement on how Micronaut Data handles error messages for the following use case.
When using a validated
@Embeddable
, if:The error message is a bit confusing, as it says that the whole
@Embeddable
is null/missing. Take for example these data models:If the DB has a missing/null
createdBy
field, for instance, this is the error message throw by the repository:Error instantiating entity [io.github.nahuel92.MyEntity]: Null argument specified for [auditFields]. If this argument is allowed to be null annotate it with @Nullable
This can be improved by making the error message something like this:
Error instantiating entity [io.github.nahuel92.MyEntity]: Null argument specified for [auditFields.createdBy]. If this argument is allowed to be null annotate it with @Nullable
Here's an example app where you can see this in action:
https://github.com/Nahuel92/poc-projects/tree/master/micronaut/micronaut-data-embedded-misleading-error-message
Thanks!
The text was updated successfully, but these errors were encountered: