Victor
JCHJava Community | Help. Code. Learn.
•Created by Victor on 12/7/2024 in #java-help
Best Design Approach
So im making an API for a marketplace and i have different kinds of listings (footwear, clothes and accessories) where the enum attributes "subcategory" and "size" would change based on what kind of listing it is, what would be the best design approach for creating these listings? inheritance? factory? Thanks
6 replies
JCHJava Community | Help. Code. Learn.
•Created by Victor on 7/23/2024 in #java-help
SPRING: validation returning error 500 instead of 400
Why does the validation return an internal server error instead of a bad request when the request does not pass validation? I've seen some videos about validation and in the examples it returned a bad request but in my application its returning error 500, here is my model class
the post method
and this is the error when i send a request with a blank username:
jakarta.validation.ConstraintViolationException: Validation failed for classes [com.vss.wardrober.models.UserModel] during persist time for groups [jakarta.validation.groups.Default, ]
List of constraint violations:[
ConstraintViolationImpl{interpolatedMessage='must not be blank', propertyPath=username, rootBeanClass=class com.vss.wardrober.models.UserModel, messageTemplate='{jakarta.validation.constraints.NotBlank.message}'}
]
7 replies