mnahkies/openapi-code-generator

typescript-koa: support serving docs using redoc

Open

#81 opened on Sep 24, 2023

View on GitHub
 (0 comments) (0 reactions) (0 assignees)TypeScript (9 forks)auto 404
good first issuetypescript-koa

Repository metrics

Stars
 (34 stars)
PR merge metrics
 (PR metrics pending)

Description

add support for optionally serving documentation generated using https://github.com/Redocly/redoc for servers using typescript-koa template

essentially this will involve:

  • exposing a route /docs returning an html document including the redoc html below
  • exposing a route /openapi.yaml returning the specification used to generate the server

the html will look similar to:

<html>
<body>
    <redoc spec-url="http://petstore.swagger.io/v2/swagger.json"></redoc>
    <script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
</body>
</html>

with the spec path updated, and a sub resource integrity hash added (https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)

this functionality should be optional, and the routes configurable to ensure that it can be used without collision with the actual API surface.

Contributor guide