I′m using the swagger-codegen-maven-plugin(2.4.4) to generate the consumer api (okhttp) for one of our microservices from an swagger input spec (v2). At the moment we have two microservices built in spring-boot: microservice A and microservice B. Microservice A acts as a "proxy" and streams the incomming requests directly to microservice B. The RestController from microservice A takes a HttpServletRequest as an controller argument. The RestController from microservice B takes an InputStreamResource as an controller argument. Both endpoints are POST requests.
//@RestController - Microservice A
ResponseEntity<Metadata> streamData(HttpServletRequest request) throws IOException, FileUploadException;
|| calls
/
-- swagger-codegen-maven-plugin generated API --
|| calls
/
//@RestController - Microservice B
ResponseEntity<Metadata> workOnStream(InputStreamResource dataStream);
If I let the plugin generate the consumer api for microservice B, it generates complete garbage as if it doesnt know how to generate the code for the InputStreamResource parameter.
Now there arise two questions:
- How are streams defined in the swagger spec ? Is there any definitition of a stream ?
- Do you have any idea why the swagger-codegen-maven-plugin doesnt want to generate the InputStreamResource parameter in the consumer api ?
Thanks!
question from:https://stackoverflow.com/questions/66060333/inputstreamresource-swagger-specification-v2