0

我是 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());

    }

任何帮助或参考将不胜感激。谢谢大家。

4

1 回答 1

2

你可以看看 SpringDoc https://github.com/springdoc/springdoc-openapi

它将为您即时生成文档。

于 2019-08-20T21:59:45.970 回答