You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Or get the already-parsed object (Map / List) produced by the registered TypeMapper.
45
+
//Loose structural view (Map / List / boxed primitives), produced by the registered TypeMapper.
46
46
Object parsed = request.parsed();
47
+
// Or, when the JSON mapper is Jackson (a TypedTypeMapper), get a typed POJO directly.
48
+
MyDto dto = request.asPojo(MyDto.class);
47
49
// Path parameters, query parameters, and headers are also available.
48
50
String id = request.pathParam("id");
49
51
String filter = request.queryParam("filter");
50
52
String corr = request.header("correlation-id");
51
53
52
-
returnResponse.ok(parsed);
54
+
returnResponse.ok(dto);
53
55
}
54
56
}
55
57
```
@@ -132,7 +134,7 @@ var server = OpenApiServer.builder()
132
134
.build();
133
135
```
134
136
135
-
The same shape applies to any custom mapper — implement `TypeMapper` and register it.
137
+
The same shape applies to any custom mapper — implement `TypeMapper`(and optionally `TypedTypeMapper` if you can deserialise directly into a target type, so handlers can call `request.asPojo(MyDto.class)`).
136
138
137
139
If neither Gson is on the classpath nor any `application/json` mapper is registered, `build()` throws `IllegalStateException`.
0 commit comments