【问题标题】:How to create an Open API 3.0.1 Specification如何创建 Open API 3.0.1 规范
【发布时间】:2019-08-20 16:15:54
【问题描述】:

我不熟悉招摇文档等 请您分享为以下端点创建开放 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());

    }

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

【问题讨论】:

    标签: spring-boot swagger-2.0 openapi swagger-codegen openapi-generator


    【解决方案1】:

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

    它将为您即时生成文档。

    【讨论】:

      猜你喜欢
      • 2022-10-24
      • 2019-09-01
      • 2020-05-14
      • 1970-01-01
      • 2021-07-21
      • 2020-03-13
      • 1970-01-01
      • 2020-10-24
      • 1970-01-01
      相关资源
      最近更新 更多