簡體   English   中英

從Swagger獲取模型架構

[英]Fetching a model schema from Swagger

我正在嘗試在Swagger中獲取項目的模型架構。 我想通過來自托管Swagger的另一台計算機的http請求來執行此操作。

我可以從json中獲取Swagger API文檔作為json:

domain.com/swagger/v2/api-docs.json

響應包含:

{
  "swagger": "2.0",
  ...
  paths: {
    "/endpoint": {
      "get": {
        ...
        "responses": {
          "200":{
            "description":"OK",
            "schema": {
              "type":"array",
              "items": {
                "$ref":"#/definitions/Item"
              }
            }
          }
        }
      }
    }
  }
}

有什么方法可以獲取“ / definitions / Item”模型架構?

我想對以下內容執行http GET:

domain.com/swagger/v2/api-docs/definitions/Item.json

我正在使用Swagger 2.0版。

謝謝

它在同一文檔的底部。 例如:如果轉到swagger編輯器的實時演示( http://editor.swagger.io/#/edit )並滾動到底部,您將看到端點定義中引用的對象定義。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM