我是swagger文档等方面的新手。请分享任何好的资源或步骤,以便为以下端点创建开放式api规范,该端点是spring boot微服务的端点:
@PostMapping(path = "/pdf", produces = MediaType.APPLICATION_PDF_VALUE)
public ResponseEntity<ByteArrayResource> createReport(@RequestParam MultipartFile template, @RequestParam MultipartFile templateDataAsJson) throws IOException {
log.info("Triggering PDF Generation and Download");
log.info("Step 1 Starts : Sending Json data to the template data binder microservice: Request:{}", templateDataAsJson);
String completedHtmlJson = restClient.populateTemplate(template, templateDataAsJson);
log.info("Steps 2 Starts: Sending populated html template to html-to-pdf microservice for rendering:{}", completedHtmlJson);
ResponseEntity<ByteArrayResource> response = restClient.html2PdfGeneration(completedHtmlJson);
return ResponseEntity.ok().contentType(APPLICATION_PDF).body(response.getBody());
}任何帮助或参考将不胜感激。谢谢大家。
发布于 2019-08-21 05:59:46
你可以看看SpringDoc https://github.com/springdoc/springdoc-openapi
它将为您即时生成文档。
https://stackoverflow.com/questions/57577749
复制相似问题