Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nested request body inside @BeanParam #3806

Open
jerseyrobot opened this issue Apr 17, 2018 · 2 comments
Open

Allow nested request body inside @BeanParam #3806

jerseyrobot opened this issue Apr 17, 2018 · 2 comments

Comments

@jerseyrobot
Copy link
Contributor

That would be a brilliant aggregate

@Value
@Builder(toBuilder = true)
@NoArgsConstructor(force = true)
@AllArgsConstructor
public class Changes {

    @Context
    Locale locale;

    @HeaderParam("Authorization")
    String token;

    @QueryParam("rewrite")
    String rewrite;

    @PathParam("id")
    String id;
    
    @JsonProperty
    @NotNull
    @Valid
    AddressDTO three;

}

Now AddressDTO is null, of course

so instead,

@POST
UserDTO dostuff(@BeanParam Changes changes, @NotNull @Valid UserDTO)

you could just

@POST
UserDTO dostuff(@BeanParam Changes changes)

and of course deep nesting would allow even more.
Especially with some libraries like mapstruct, where all that hierarchy automatically would be remapped to any other bunch of objects with possibly completely different topology. This would allow very convenient transitioning from web-specific layer data to , say, db/persistence layer.

@jerseyrobot
Copy link
Contributor Author

@jerseyrobot
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant