We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi @dilipkrish, just wanted to check before opening an issue.
In Webflux projects, the generated responses and definitions don't seem to be correct when returning a Mono or Flux.
Simple DTO:
public class HelloDto { private final String message; ...
Controller
@GetMapping("/hello") public Mono<HelloDto> hello() { return Mono.fromSupplier(() -> new HelloDto("Hello SpringFox!")); } @GetMapping("/hellos") public Flux<HelloDto> hellos() { return Flux.just(new HelloDto("Hello SpringFox!")); }
Generated definitions:
"paths": { "/functional-hello/hello": { "get": { "tags": [ "functional-hello-world-controller" ], "summary": "hello", "operationId": "helloUsingGET", "produces": [ "*/*" ], "responses": { "200": { "description": "Ok", "schema": { "$ref": "#/definitions/Mono«HelloDto»" } }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } }, "/functional-hello/hellos": { "get": { "tags": [ "functional-hello-world-controller" ], "summary": "hellos", "operationId": "hellosUsingGET", "produces": [ "*/*" ], "responses": { "200": { "description": "Ok", "schema": { "$ref": "#/definitions/Flux«HelloDto»" } }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } } }, "definitions": { "Flux«HelloDto»": { "type": "object", "properties": { "prefetch": { "type": "integer", "format": "int32" } }, "title": "Flux«HelloDto»" }, "HelloDto": { "type": "object", "properties": { "message": { "type": "string" } }, "title": "HelloDto" }, "Mono«HelloDto»": { "type": "object", "title": "Mono«HelloDto»" } } }
As you can see /functional-hello/hello has a response with this definition #/definitions/Mono«HelloDto» which is
"Mono«HelloDto»": { "type": "object", "title": "Mono«HelloDto»" }
Shouldn't it just point at #/definitions/HelloDto which has the actual definition?
"HelloDto": { "type": "object", "properties": { "message": { "type": "string" } }, "title": "HelloDto" },
The same happens for Flux. I guess it shoud be a response with and array of #/definitions/HelloDto
What do you think?
BTW I tried explicitly using @ApiResponse annotations and didn't make any change:
@ApiResponses(@ApiResponse(code = 200, message = "Ok", response = HelloDto.class)) ... @ApiResponses(@ApiResponse(code = 200, message = "Ok", response = HelloDto.class, responseContainer = "List")) ...
Originally posted by @svpr3m0 in #3070 (comment)
The text was updated successfully, but these errors were encountered:
cbfb43f
No branches or pull requests
Hi @dilipkrish, just wanted to check before opening an issue.
In Webflux projects, the generated responses and definitions don't seem to be correct when returning a Mono or Flux.
Simple DTO:
Controller
Generated definitions:
As you can see /functional-hello/hello has a response with this definition #/definitions/Mono«HelloDto» which is
Shouldn't it just point at #/definitions/HelloDto which has the actual definition?
The same happens for Flux. I guess it shoud be a response with and array of #/definitions/HelloDto
What do you think?
BTW I tried explicitly using @ApiResponse annotations and didn't make any change:
Originally posted by @svpr3m0 in #3070 (comment)
The text was updated successfully, but these errors were encountered: