katharsis-project / katharsis-framework

Katharsis adds powerful layer for RESTful endpoints providing implementenation of JSON:API standard
http://katharsis.io
Apache License 2.0
133 stars 65 forks source link

validation module not working with jpa mapped entity, resource registry does not contain mapped entity as entry #421

Open exports opened 7 years ago

exports commented 7 years ago

In katharsis validation module, when a jpa entity fails in validation, the ConstraintViolationExceptionMapper.java is invoked, and it tries to get the entity info with resourceRegistry.findEntry(clazz). However this exception mapper is not working properly when using jpa entity with mapped dto support, the resource registry only contains the original entity class as entry, so findEntry() will always raise an error.

So this is actually a bug on resourceRegistry. it could be easily fixed by adding the mapped dto entry with exactly the same resource info when register jpa mapped entity repository in resourceRegistry.

chb0github commented 7 years ago

I have assigned it to the author of that module.