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

Use 2 differentes JSONView in a method (parameter and return) #265

Open
domroydumcn opened this issue Oct 22, 2024 · 0 comments
Open

Use 2 differentes JSONView in a method (parameter and return) #265

domroydumcn opened this issue Oct 22, 2024 · 0 comments

Comments

@domroydumcn
Copy link

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());
    }
@domroydumcn domroydumcn changed the title Use differents views of a same DTO in the parameters and the response of a method Use 2 differentes JSONView in a method (parameter and return) Oct 22, 2024
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