Skip to content

Commit b851d3c

Browse files
committed
missing 'plain' documentation
1 parent 12016a6 commit b851d3c

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

docs/modules/ROOT/pages/mapping/result.adoc

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A link:{spring-responseentity}[`ResponseEntity<>`] allows an endpoint implementa
77

88
Here is a super simple example:
99

10-
[source,java]
10+
[source,java,title=Java code]
1111
----
1212
public ResponseEntity<String> getFoo() {
1313
return ResponseEntity.ok("foo");
@@ -16,7 +16,7 @@ public ResponseEntity<String> getFoo() {
1616

1717
To 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
----
2121
map:
2222
result: org.springframework.http.ResponseEntity
@@ -46,7 +46,7 @@ The **standard** `result` mapping requires a generic wrapper type, like `Respons
4646

4747
which 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
----
5151
openapi-processor-mapping: {var-mapping-version}
5252
@@ -64,15 +64,35 @@ map:
6464

6565
The `result` mapping works as endpoint-specific mapping too. That way it is possible to use the `ResponseEntity<>` only on single endpoints.
6666

67-
6867
So a mapping like this:
6968

70-
[source,yaml]
69+
[source,yaml,title=mapping]
7170
----
7271
map:
73-
7472
/foo:
7573
result: org.springframework.http.ResponseEntity
7674
----
7775

7876
will 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

Comments
 (0)