Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
144 views
in Technique[技术] by (71.8m points)

java - InputStreamResource - Swagger Specification V2

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:

  1. How are streams defined in the swagger spec ? Is there any definitition of a stream ?
  2. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...