3

Could someone share some examples on how to implement API Documentation using ReDoc along with SpringBoot framework. It would be great help if someone knows some good examples with ReDoc + Springboot.

Varun
  • 85
  • 1
  • 7

1 Answers1

4

You can create a spring boot application enabling springdoc-openapi-ui [1] and then add a static html [2] as shown in here! by changing spec-url as http://localhost:8080/v3/api-docs [3]

[1] : https://www.baeldung.com/spring-rest-openapi-documentation

[2] : https://stackoverflow.com/a/42393332/878710

[3] :

<!DOCTYPE html>
<html>
  <head>
    <title>Redoc</title>
    <!-- needed for adaptive design -->
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">

    <!--
    Redoc doesn't change outer page styles
    -->
    <style>
      body {
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <redoc spec-url='http://localhost:8080/v3/api-docs'></redoc>
    <script src="https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js"> </script>
  </body>
</html>
ozkansari
  • 121
  • 7