Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for DeferredResult #804

Closed
nk-rks opened this issue Jul 28, 2020 · 1 comment
Closed

Support for DeferredResult #804

nk-rks opened this issue Jul 28, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@nk-rks
Copy link

nk-rks commented Jul 28, 2020

My server supports asynchronous Servlet processing, so it returns entities of type DeferredResult.
DeferredResult is a special type which the Servelet recognizes, and extracts from it the type referenced in the DeferredResult definition.

e.g. The pojo is defined with a member of type DeferredResult, and the actual entity returned by the Servlet to the end-user is the type referenced in the DeferredResult definition, e.g. ActualReturnedEntity.

The problem is that sprindoc documents the DeferredResult as DeferredResultActualReturnedEntity.
The expectation is for sprindoc to document the referenced entity: ActualReturnedEntity

There was a similar issue with springfox: springfox/springfox#346

spring-boot: 2.0.3
springdoc-openapi: 1.4.3

Sample server code:

@ApiResponses({@ApiResponse(responseCode = "200")})
public @ResponseBody DeferredResult<OperationResponse<ActualReturnedEntity>> update(
  @RequestBody ActualReturnedEntity entity) throws Exception {
	return null;
}

Actual result:

{
  "responses": {
  "200": {
    "description": "OK",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DeferredResultOperationResponseActualReturnedEntity"
        }
    }
  }
}

Expected results:

{
  "responses": {
  "200": {
    "description": "OK",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/OperationResponseActualReturnedEntity"
        }
    }
  }
}
@bnasslahsen
Copy link
Collaborator

Hi @nk-rks,

To get your expected result, you can declare DeferredResult as follow;

static {
	SpringDocUtils.getConfig().addResponseWrapperToIgnore(DeferredResult.class);
}

Starting from the next release, v1.4.4, it will be added out of the box.

@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants