view common/json/src/test/resources/systems-swagger.json @ 23:ab2706b9b1e3

Add common YAML utilities (The previous commit was missing the new files for this functionality.) This patch adds YAML reading and writing utilities to the base common packages. The intent is we'll be able to compare (at build time) our Swagger API definitions to our Java models (or even build them), or convert the YAML to Java schema for use with the schema validation utilities. Reviewed-by: sgehwolf, neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-September/024988.html
author stooke@redhat.com
date Fri, 15 Sep 2017 11:41:22 -0400
parents
children
line wrap: on
line source

{
  "swagger": "2.0",
  "info": {
    "version": "0.0.1",
    "title": "Thermostat Web Gateway System Information API",
    "license": {
      "name": "GPL v2 with Classpath Exception",
      "url": "http://www.gnu.org/licenses"
    }
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json",
    "text/html; charset=utf-8"
  ],
  "basePath": "/systems/0.0.1",
  "paths": {
    "/": {
      "get": {
        "description": "Get information for all systems.",
        "parameters": [
          {
            "$ref": "#/parameters/limit"
          },
          {
            "$ref": "#/parameters/offset"
          },
          {
            "$ref": "#/parameters/sort"
          },
          {
            "$ref": "#/parameters/include"
          },
          {
            "$ref": "#/parameters/exclude"
          },
          {
            "$ref": "#/parameters/query"
          },
          {
            "$ref": "#/parameters/alive"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/systems-get-response"
            }
          }
        }
      }
    },
    "/systems/{systemId}": {
      "parameters": [
        {
          "$ref": "#/parameters/system-id"
        }
      ],
      "get": {
        "description": "Get information for system {systemId}.",
        "parameters": [
          {
            "$ref": "#/parameters/limit"
          },
          {
            "$ref": "#/parameters/offset"
          },
          {
            "$ref": "#/parameters/sort"
          },
          {
            "$ref": "#/parameters/include"
          },
          {
            "$ref": "#/parameters/exclude"
          },
          {
            "$ref": "#/parameters/query"
          },
          {
            "$ref": "#/parameters/alive"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/systems-get-response"
            }
          }
        }
      },
      "put": {
        "description": "Update information for system {systemId}.",
        "parameters": [
          {
            "$ref": "#/parameters/systems-put-body"
          },
          {
            "$ref": "#/parameters/query"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "description": "Add information for system {systemId}",
        "parameters": [
          {
            "$ref": "#/parameters/system-info-array"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "description": "Delete information for system ID {systemId}.",
        "parameters": [
          {
            "$ref": "#/parameters/query"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "definitions": {
    "systems-get-response": {
      "type": "object",
      "properties": {
        "response": {
          "$ref": "#/definitions/system-info-array"
        }
      }
    },
    "system-info-array": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/system-info"
      }
    },
    "system-info": {
      "type": "object",
      "properties": {
        "systemId": {
          "type": "string"
        },
        "agentId": {
          "type": "string"
        },
        "hostname": {
          "type": "string"
        },
        "osName": {
          "type": "string"
        },
        "osKernel": {
          "type": "string"
        },
        "osArch": {
          "type": "string"
        },
        "cpuCount": {
          "type": "integer"
        },
        "cpuModel": {
          "type": "string"
        },
        "totalMemory": {
          "type": "integer",
          "format": "int64"
        },
        "timeCreated": {
          "type": "integer",
          "format": "int64"
        },
        "lastUpdated": {
          "type": "integer",
          "format": "int64"
        }
      }
    },
    "systems-put-body": {
      "type": "object",
      "properties": {
        "set": {
          "type": "object"
        }
      }
    }
  },
  "parameters": {
    "system-id": {
      "name": "systemId",
      "in": "path",
      "required": true,
      "type": "string"
    },
    "system-info-array": {
      "name": "system-info-array",
      "in": "body",
      "description": "The system information",
      "required": true,
      "schema": {
        "$ref": "#/definitions/system-info-array"
      }
    },
    "systems-put-body": {
      "name": "body",
      "in": "body",
      "description": "The JSON object containing a 'set' object. This contains single item JSON objects that specify the field to replace and the JSON value to replace with. Must not include 'systemId' field. Example { \"set\" : { \"field\" : \"value\", \"field2\":{\"object\":\"item\"} }",
      "required": true,
      "schema": {
        "$ref": "#/definitions/systems-put-body"
      }
    },
    "alive": {
      "name": "alive",
      "in": "query",
      "description": "Whether to return only systems that are currently running",
      "type": "boolean",
      "required": false,
      "default": true
    },
    "limit": {
      "name": "limit",
      "in": "query",
      "description": "Limit of items to return. Example '1'",
      "type": "integer",
      "required": false,
      "default": 1
    },
    "offset": {
      "name": "offset",
      "in": "query",
      "description": "Offset of items to return. Example '0'",
      "type": "integer",
      "required": true,
      "default": 0
    },
    "sort": {
      "name": "sort",
      "in": "query",
      "description": "Sort string. Comma separated list of fields prefixed with '+' for ascending or '-' for descending. Example '?sort=+a,-b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.",
      "type": "string",
      "required": false
    },
    "query": {
      "name": "query",
      "in": "query",
      "description": "Query string. Comma separated list of key, comparator, value pairs. Comparator supports '==', '<=', '>=', '<', '>', '!='. Example '?query=a==b,c!=d'. Keys are fields in documents and use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.",
      "type": "string",
      "required": false
    },
    "include": {
      "name": "include",
      "in": "query",
      "description": "Inclusion string. Comma separated list of fields to include in the response. Example '?include=a,b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer. Cannot be used in combination with 'exclude' parameter Overriden by 'exclude' parameter",
      "type": "string",
      "required": false
    },
    "exclude": {
      "name": "exclude",
      "in": "query",
      "description": "Exclusion string. Comma separated list of fields to exclude in the response. Example '?exclude=a,b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer. Cannot be used in combination with 'include' parameter; takes precedence over 'include' parameter",
      "type": "string",
      "required": false
    }
  }
}