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,
Springdoc fails to generate the response schema for spring boot controller methods with Callable. (spring boot async support using Callable docs)
For example the controller method:
@RequestMapping(value = "/tasks", method = RequestMethod.GET) private Callable<ResponseEntity<Page<TaskDTO>>> getTasks( @RequestParam(required = false) Predicate predicate, Pageable pageable) { return () -> { Page<TaskDTO> fetchResult = fetchService.getTasks(pageable, predicate); return new ResponseEntity<>(fetchResult); }; }
I was able to work around it by overriding the calculateSchemaFromParameterizedType method in the ResponseBuilder class, like this:
calculateSchemaFromParameterizedType
ResponseBuilder
@ComponentScan(basePackages = {"org.springdoc.core"}) @Configuration public class SpringDocConfig { private final OperationBuilder builder; public SpringDocConfig(OperationBuilder builder) { this.builder = builder; } @Bean public ResponseBuilder responseBuilder(){ return new ResponseBuilderWithCallableHandling(builder); } public class ResponseBuilderWithCallableHandling extends ResponseBuilder{ ResponseBuilderWithCallableHandling(OperationBuilder operationBuilder) { super(operationBuilder); } @Override protected Schema calculateSchemaFromParameterizedType(Components components, ParameterizedType parameterizedType, JsonView jsonView) { Schema<?> schemaN = null; if (Callable.class.getName().contentEquals(parameterizedType.getRawType().getTypeName())) { Type type = parameterizedType.getActualTypeArguments()[0]; if(type instanceof ParameterizedType){ schemaN = super.calculateSchemaFromParameterizedType(components, (ParameterizedType)type, jsonView); }else { schemaN = this.calculateSchemaParameterizedType(components, parameterizedType, jsonView); } }else { schemaN = super.calculateSchemaFromParameterizedType(components, parameterizedType, jsonView); } return schemaN; } } }
It would be great if you could add support for Callable in future releases.
The text was updated successfully, but these errors were encountered:
6434a64
No branches or pull requests
Hi,
Springdoc fails to generate the response schema for spring boot controller methods with Callable. (spring boot async support using Callable docs)
For example the controller method:
I was able to work around it by overriding the
calculateSchemaFromParameterizedType
method in theResponseBuilder
class, like this:It would be great if you could add support for Callable in future releases.
The text was updated successfully, but these errors were encountered: