Skip to content

Get Serialized Names in Exception Handler #26508

Closed as not planned
Closed as not planned
@dirweis

Description

@dirweis

In the ExceptionHandler for MethodArgumentNotValidExceptions a way for getting the serialized names of the violated fields is missing. Using MethodArgumentNotValidException.getBindingResult().getAllErrors() ... FieldError.getField() the POJO's name is returned which is not acceptable for the response body in case of different serialized names (Example: photoUrls vs. photo-urls).

Code:

@JsonProperty("photo-urls")
private List<URL> photoUrls;

In this case photoUrls is returned which is the wrong key for the client's request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions