Skip to content

Use 2 different @JsonView in a method (parameter and return) #265

Description

@domroydumcn

Allow using one view as input and a different view of the same DTO as output to a method.
Like this :

@POST
    @Path("/add")
    @JsonView(parameter=ExempleViews.Ajout.class, return=ExempleViews.Response.class)  // <-- like this
    @APIResponse(responseCode = "201", description = "Add with success")
    @APIResponse(responseCode = "400", description = "Bad request")
    @APIResponse(responseCode = "409", description = "Conflict in database")
    @APIResponse(responseCode = "500", description = "Internal error")
    public Uni<Response> add(@Valid @NotNull ExampleDto exampleDto) {

        return exampleService
                .add(exampleDto)
                .map(e -> Response.ok(e).status(Status.CREATED).build());
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions