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

Allow nested request body inside @BeanParam #3806

@soberich

Description

@soberich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions