Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Allow nested request body inside @BeanParam #3806

Open
soberich opened this issue Apr 17, 2018 · 1 comment
Open

Allow nested request body inside @BeanParam #3806

soberich opened this issue Apr 17, 2018 · 1 comment

Comments

@soberich
Copy link

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.

@soberich soberich changed the title Allow nested request body @BeanParam Allow nested request body inside @BeanParam Apr 17, 2018
@soberich
Copy link
Author

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

No branches or pull requests

1 participant