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?

OpenAPI逆引きメモ

Last updated at Posted at 2024-02-01

必要に迫られたOpenAPI関連の逆引きメモになります

サンプルの複数記述

examples フィールドはOpenAPI Specification 3.0以降でのみ使用可能

paths:
  /your/path:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/YourRequestBodySchema'
            examples:
              example1:
                summary: サンプル1の説明
                value:
                  # ここにサンプル1のリクエストボディを記述
              example2:
                summary: サンプル2の説明
                value:
                  # ここにサンプル2のリクエストボディを記述

yamlをhtmlへ変換

DockerでRedocly CLIを使用してyamlをhtmlへ変換

docker run --rm -v "C:\.swagger:/spec" redocly/cli build-docs /spec/test_api.yaml -o /spec/test_api.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?