シェルスクリプトマガジン

Webアプリケーションの正しい作り方(Vol.66記載)

著者:しょっさん

ソフトウエアを正しく作るために、エンジニアたちはどんなことを知らなければならないでしょうか。実際のコードを使って、より良くしていくためのステップを考えてみましょう。第6回は、アプリケーションの開発やテストを実施する環境について詳しく考えます。

シェルスクリプトマガジン Vol.66は以下のリンク先でご購入できます。

図2 モックのコード(swagger.json)

{
  "openapi" : "3.0.0",
  "servers" : [ {
    "description" : "Expense Reporter Sample API",
    "url" : "https://virtserver.swaggerhub.com/sho7650/ExpenseMockServices/0.5.0"
  } ],
  "info" : {
    "description" : "シェルスクリプトマガジン用サンプル",
    "version" : "0.5.0",
    "title" : "Expense API",
    "contact" : {
      "email" : "sho@oshiire.to"
    },
    "license" : {
      "name" : "Apache 2.0",
      "url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "tags" : [ {
    "name" : "users",
    "description" : "一般利用者"
  }, {
    "name" : "approvers",
    "description" : "承認者"
  } ],
  "paths" : {
		(略)
    "/payment" : {
      "get" : {
        "tags" : [ "approvers" ],
        "summary" : "支払い待ち一覧",
        "operationId" : "findPayments",
        "description" : "一般利用者からの請求一覧を表示",
        "security" : [ {
          "bearerAuth" : [ ]
        } ],
		(略)
        "responses" : {
          "200" : {
            "description" : "success",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/ExpenseItem"
                  }
                }
              }
            }
          },
          "400" : {
            "description" : "bad input parameter"
          }
        }
      }
    }
  },
  "components" : {
    "securitySchemes" : {
      "bearerAuth" : {
        "type" : "http",
        "scheme" : "bearer",
        "bearerFormat" : "JWT"
      }
    },
    "schemas" : {
      "id" : {
        "type" : "integer",
        "format" : "int32",
        "example" : 120
      },
	(略)
    }
  }
}