Skip to content

Commit 65ae8ba

Browse files
committed
Add Future to ignored response wrappers. Fixes #2917.
1 parent c07093c commit 65ae8ba

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocConfiguration.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.Map;
3535
import java.util.Optional;
3636
import java.util.Set;
37+
import java.util.concurrent.Future;
3738

3839
import com.fasterxml.jackson.databind.node.ObjectNode;
3940
import com.querydsl.core.types.Predicate;
@@ -153,7 +154,8 @@ public class SpringDocConfiguration {
153154
static {
154155
getConfig().replaceWithSchema(ObjectNode.class, new ObjectSchema())
155156
.replaceWithClass(Charset.class, String.class)
156-
.addResponseWrapperToIgnore(DeferredResult.class);
157+
.addResponseWrapperToIgnore(DeferredResult.class)
158+
.addResponseWrapperToIgnore(Future.class);
157159
}
158160

159161
/**

springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app129/HelloController.java

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
package test.org.springdoc.api.v31.app129;
2626

27+
import java.util.concurrent.CompletableFuture;
28+
2729
import io.swagger.v3.oas.annotations.responses.ApiResponse;
2830
import io.swagger.v3.oas.annotations.responses.ApiResponses;
2931

@@ -43,4 +45,11 @@ public DeferredResult<OperationResponse<ActualReturnedEntity>> update(
4345
@RequestBody ActualReturnedEntity entity) throws Exception {
4446
return null;
4547
}
48+
49+
@PostMapping("/test2")
50+
@ApiResponses({ @ApiResponse(responseCode = "200") })
51+
public CompletableFuture<OperationResponse<ActualReturnedEntity>> update2(
52+
@RequestBody ActualReturnedEntity entity) throws Exception {
53+
return null;
54+
}
4655
}

springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app129.json

+46
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,52 @@
5656
}
5757
}
5858
}
59+
},
60+
"/api/test2": {
61+
"post": {
62+
"tags": [
63+
"hello-controller"
64+
],
65+
"operationId": "update2",
66+
"parameters": [
67+
{
68+
"name": "userId",
69+
"in": "header",
70+
"schema": {
71+
"type": "string"
72+
}
73+
},
74+
{
75+
"name": "registrationId",
76+
"in": "header",
77+
"schema": {
78+
"type": "string"
79+
}
80+
}
81+
],
82+
"requestBody": {
83+
"content": {
84+
"application/json": {
85+
"schema": {
86+
"$ref": "#/components/schemas/ActualReturnedEntity"
87+
}
88+
}
89+
},
90+
"required": true
91+
},
92+
"responses": {
93+
"200": {
94+
"description": "OK",
95+
"content": {
96+
"*/*": {
97+
"schema": {
98+
"$ref": "#/components/schemas/OperationResponseActualReturnedEntity"
99+
}
100+
}
101+
}
102+
}
103+
}
104+
}
59105
}
60106
},
61107
"components": {

0 commit comments

Comments
 (0)