0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

お手軽Redoc入門

0
Posted at

結論

下記のようにHTMLとAPI仕様yamlを用意し、ローカルサーバーを立ち上げればよい。
ローカルサーバーを立ち上げるのがポイントで、そうしないと、エラーになる。
理由はわからない。(ご存じの方教えてください...)

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Redoc Sample</title>
</head>
<body>
    <redoc spec-url='./swagger.yaml'></redoc>
    <script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
</body>
</html>
swagger.yaml
この中身は下記取得し、書き換えてください。
https://petstore.swagger.io/v2/swagger.yaml

server立ち上げ
>python -m http.server -8000
## ブラウザでlocalhost:8000 にアクセスできるようになる

経緯とか

API仕様書をエクセルで管理すると更新情報の記載だったり、差分の確認がそもそも困難だったりといろんなデメリットがあります。
UIがそこそこなのはメリットですが。

とりあえずお試しで使ってみてます。

参考記事

https://hirabay.net/?p=108
https://techblog.asia-quest.jp/202207/api-documentation-has-been-redesigned-with-redoc
https://qiita.com/tuken24/items/fc002cd373bbcc9b726c

pythonでローカルサーバー
https://qiita.com/okhrn/items/4d3c74563154f191ba16

ローカルのyamlが表示できない問題の話題(ローカルサーバーで解決)
https://github.com/Redocly/redoc/issues/1222
https://stackoverflow.com/questions/75300068/redoc-cannot-display-a-local-openapi-definition-file

公式の説明 ローカルサーバーが必要な記述、、、ある?
https://redocly.com/docs/redoc/deployment/html/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?