{
  "swagger": "2.0",
  "info": {
    "description": "A basic swagger file",
    "version": "1.0.0",
    "title": "CRUD"
  },
  "host": "example.com",
  "tags": [
    {
      "name": "entity"
    }
  ],
  "schemes": [
    "http"
  ],
  "paths": {
    "/entities": {
      "post": {
        "tags": [
          "entity"
        ],
        "operationId": "createEntity",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "$ref": "#/parameters/CreateEntity"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/Entity"
            }
          }
        }
      },
      "get": {
        "tags": [
          "entity"
        ],
        "operationId": "getEntities",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "$ref": "#/parameters/Page"
          },
          {
            "$ref": "#/parameters/Size"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/Entities"
            }
          }
        }
      }
    },
    "/entities/{entityId}": {
      "parameters": [
        {
          "$ref": "#/parameters/EntityId"
        }
      ],
      "get": {
        "tags": [
          "entity"
        ],
        "operationId": "getEntity",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/Entity"
            }
          }
        }
      },
      "put": {
        "tags": [
          "entity"
        ],
        "operationId": "updateEntity",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "$ref": "#/parameters/Entity"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/Entity"
            }
          }
        }
      },
      "patch": {
        "tags": [
          "entity"
        ],
        "operationId": "patchEntity",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "$ref": "#/parameters/Entity"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/Entity"
            }
          }
        }
      },
      "delete": {
        "tags": [
          "entity"
        ],
        "parameters": [
          {
            "$ref": "#/parameters/APIKey"
          }
        ],
        "operationId": "deleteEntity",
        "produces": [
          "application/json"
        ],
        "responses": {
          "204": {
            "description": "successful operation"
          }
        }
      }
    }
  },
  "parameters": {
    "EntityId": {
      "type": "integer",
      "format": "int64",
      "name": "entityId",
      "in": "path",
      "required": true
    },
    "CreateEntity": {
      "name": "entity",
      "in": "body",
      "required": true,
      "schema": {
        "$ref": "#/definitions/CreateEntity"
      }
    },
    "Entity": {
      "name": "entity",
      "in": "body",
      "required": true,
      "schema": {
        "$ref": "#/definitions/Entity"
      }
    },
    "Page": {
      "type": "integer",
      "format": "int32",
      "name": "page",
      "in": "query",
      "required": false
    },
    "Size": {
      "type": "integer",
      "format": "int32",
      "name": "size",
      "in": "query",
      "required": false
    },
    "APIKey": {
      "type": "string",
      "name": "x-api-key",
      "in": "header",
      "required": false
    }
  },
  "definitions": {
    "CreateEntity": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "example": {
        "name": "name",
        "type": "type"
      }
    },
    "Entity": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "format": "int64"
            }
          }
        },
        {
          "$ref": "#/definitions/CreateEntity"
        } 
      ],
      "example": {
        "id": 1,
        "name": "name",
        "type": "type"
      }
    },
    "Entities" : {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Entity"
      }
    }
  }
}
