FasterXML / FasterXML/jackson-annotations
Use 2 different `@JsonView` in a method (parameter and return)
- Vorherrschende Sprache
- Java
- Sterne
- 1.1k
- Forks
- 342
- Ø Merge
- 8 Std. 53 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
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 add(@Valid @NotNull ExampleDto exampleDto) {
return exampleService
.add(exampleDto)
.map(e -> Response.ok(e).status(Status.CREATED).build());
}
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.