所有可能的'属性'的swagger文件

时间:2018-03-08 23:56:36

标签: rest swagger

我需要调用API来持续加载数据。 API为每个事件返回不同的属性。当我创建swagger文件时,它具有样本返回的属性,但从长远来看,将有更多属性可以由源系统添加,并且它们不会在swagger文件中。 在使用其他属性动态加载数据之前,有没有办法重新创建swagger文件?

Swagger文件由Informatica Cloud根据测试连接时的样本返回生成。 属性列表根据事件类型具有不同数量的条目。

swagger文件:

{"swagger" : "2.0",
  "info" : {
    "description" : null,
    "version" : "1.0.0",
    "title" : null,
    "termsOfService" : null,
    "contact" : null,
    "license" : null
  },
  "host" : "<host>.com",
  "basePath" : "/api",
  "schemes" : [ "https" ],
  "paths" : {
    "/2.0" : {
      "post" : {
        "tags" : [ "events" ],
        "summary" : null,
        "description" : null,
        "operationId" : "events",
        "produces" : [ "application/json" ],
        "consumes" : [ "application/json" ],
        "parameters" : [ {
          "name" : "script",
          "in" : "query",
          "description" : null,
          "required" : false,
          "type" : "string"
        }, {
          "name" : "Authorization",
          "in" : "header",
          "description" : null,
          "required" : false,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/events"
            }
          }
        }
      }
    }
  },
  "definitions" : {
    "events##properties" : {
      "properties" : {
        "$app_build_number" : {
          "type" : "string"
        },
        "$app_version_string" : {
          "type" : "string"
        },
        "$carrier" : {
          "type" : "string"
        },
        "$lib_version" : {
          "type" : "string"
        },
        "$manufacturer" : {
          "type" : "string"
        },
        "$model" : {
          "type" : "string"
        },
        "$os" : {
          "type" : "string"
        },
        "$os_version" : {
          "type" : "string"
        },
        "$radio" : {
          "type" : "string"
        },
        "$region" : {
          "type" : "string"
        },
        "$screen_height" : {
          "type" : "number",
          "format" : "int32"
        },
        "$screen_width" : {
          "type" : "number",
          "format" : "int32"
        },
        "Home Step Enabled" : {
          "type" : "string"
        },
        "Number Of Lifetime Logins" : {
          "type" : "number",
          "format" : "int32"
        },
        "Sessions" : {
          "type" : "number",
          "format" : "int32"
        },
        "mp_country_code" : {
          "type" : "string"
        },
        "mp_lib" : {
          "type" : "string"
        }
      }
    },
    "events" : {
      "properties" : {
        "name" : {
          "type" : "string"
        },
        "distinct_id" : {
          "type" : "string"
        },
        "labels" : {
          "type" : "string"
        },
        "time" : {
          "type" : "number",
          "format" : "int64"
        },
        "sampling_factor" : {
          "type" : "number",
          "format" : "int32"
        },
        "dataset" : {
          "type" : "string"
        },
        "properties" : {
          "$ref" : "#/definitions/events##properties"
        }
      }
    }
  }
}

样本返回:

    "name": "Session",
    "distinct_id": "1234567890",
    "labels": [],
    "time": 1520072505000,
    "sampling_factor": 1,
    "dataset": "$event_data_set",
    "properties": {
        "$app_build_number": "900",
        "$app_version_string": "1.9",
        "$carrier": "AT&T",
        "$lib_version": "2.0.1",
        "$manufacturer": "Apple",
        "$model": "iPhone10,6",
        "$os": "iOS",
        "$os_version": "11.2.6",
        "$radio": "LTE",
        "$region": "Florida",
        "$screen_height": 667,
        "$screen_width": 375,
        "Number Of Lifetime Logins": 2,
        "Session Length": "00h:00m:08s",
        "Sessions": 43,
        "mp_country_code": "US",
        "mp_lib": "swift"
    }
}

0 个答案:

没有答案