11

我想让account参数应用于所有路径,没有任何例外。有没有办法用 Swagger 2 做到这一点?我不想account为每个路径应用参数。

{
  "swagger": "2.0",
  "info": {
    "version": "1.0",
    "title": "Doc"
  },
  "host": "localhost",
  "schemes": [
    "http"
  ],
  "produces": [
    "application/json"
  ],
  "parameters": {
    "account": {
      "in": "header",
      "name": "X-ACCOUNT",
      "description": "Account id",
      "type": "string",
      "required": true
    }
  },
  "paths": {
    "/account": {
      "get": {
        "summary": "Get account",
        "operationId": "getAccount",
        "responses": {
          "200": {
            "description": "test"
          }
        }
      }
    },
    ..... other paths
  }
}
4

0 回答 0