@@ -7,7 +7,7 @@ A link:{spring-responseentity}[`ResponseEntity<>`] allows an endpoint implementa
77
88Here is a super simple example:
99
10- [source,java]
10+ [source,java,title=Java code ]
1111----
1212public ResponseEntity<String> getFoo() {
1313 return ResponseEntity.ok("foo");
@@ -16,7 +16,7 @@ public ResponseEntity<String> getFoo() {
1616
1717To enable a result wrapper set the `result` mapping in the mapping YAML to a fully qualified java type.
1818
19- [source,yaml]
19+ [source,yaml,title=mapping ]
2020----
2121map:
2222 result: org.springframework.http.ResponseEntity
@@ -46,7 +46,7 @@ The **standard** `result` mapping requires a generic wrapper type, like `Respons
4646
4747which means, instead of the plain schema described in the OpenAPI response, use the `target type` as endpoint return type.
4848
49- [source,yaml,subs=attributes+]
49+ [source,yaml,subs=attributes+,title=mapping.yaml ]
5050----
5151openapi-processor-mapping: {var-mapping-version}
5252
6464
6565The `result` mapping works as endpoint-specific mapping too. That way it is possible to use the `ResponseEntity<>` only on single endpoints.
6666
67-
6867So a mapping like this:
6968
70- [source,yaml]
69+ [source,yaml,title=mapping ]
7170----
7271map:
73-
7472 /foo:
7573 result: org.springframework.http.ResponseEntity
7674----
7775
7876will only wrap the result of the endpoint `/foo`.
77+
78+
79+ In case of global type mapping
80+
81+ [source,yaml,title=mapping.yaml fragment]
82+ ----
83+ map:
84+ result: org.springframework.http.ResponseEntity
85+ ----
86+
87+ that should not apply to a specific endpoint it is possible to _clear_ the global mapping by setting `result` to `plain`:
88+
89+ [source,yaml,title=mapping]
90+ ----
91+ map:
92+ result: org.springframework.http.ResponseEntity
93+
94+ paths:
95+ /foo:
96+ # clear the top level "result" property, "plain" means no wrapper
97+ result: plain
98+ ----
0 commit comments