{
  "swagger": "2.0",
  "info": {
    "version": "1.2.6",
    "title": "Examples",
    "description": "Routes that have been enabled in the application."
  },
  "basePath": "/",
  "schemes": [
    "http",
    "https"
  ],
  "consumes": [
    "application/vnd.api+json"
  ],
  "produces": [
    "application/vnd.api+json"
  ],
  "paths": {
    "/login": {
      "post": {
        "summary": "Create a new session.",
        "operationId": "loginPost",
        "tags": [
          "Login"
        ],
        "parameters": [
          {
            "name": "json",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/LoginPost"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "403": {
            "description": "Forbidden"
          },
          "422": {
            "description": "Unprocessable Entity",
            "schema": {
              "$ref": "#/definitions/ValidationError"
            }
          }
        }
      },
      "get": {
        "summary": "Check session status.",
        "operationId": "loginGet",
        "tags": [
          "Login"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "$ref": "#/definitions/LoginSuccess"
            }
          },
          "403": {
            "description": "Forbidden"
          },
          "422": {
            "description": "Unprocessable Entity",
            "schema": {
              "$ref": "#/definitions/ValidationError"
            }
          }
        }
      }
    },
    "/user": {
      "post": {
        "summary": "Create a new user.",
        "operationId": "userPost",
        "tags": [
          "User"
        ],
        "parameters": [
          {
            "name": "json",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/UserPost"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "schema": {
              "$ref": "#/definitions/UserGetOne"
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "422": {
            "description": "Unprocessable Entity",
            "schema": {
              "$ref": "#/definitions/ValidationError"
            }
          }
        }
      },
      "get": {
        "summary": "List all users.",
        "operationId": "userGetAll",
        "tags": [
          "User"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "$ref": "#/definitions/UserGetAll"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/user/00000000-0000-0000-0000-000000000001": {
      "get": {
        "summary": "List one user.",
        "operationId": "userGetOne",
        "tags": [
          "User"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "$ref": "#/definitions/UserGetOne"
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "422": {
            "description": "Unprocessable Entity",
            "schema": {
              "$ref": "#/definitions/ValidationError"
            }
          }
        }
      },
      "patch": {
        "summary": "Update a user (property)",
        "operationId": "userPatch",
        "tags": [
          "User"
        ],
        "parameters": [
          {
            "name": "json",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/UserPatch"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized"
          },
          "422": {
            "description": "Unprocessable Entity",
            "schema": {
              "$ref": "#/definitions/ValidationError"
            }
          }
        }
      },
      "put": {
        "summary": "Update a user (resource)",
        "operationId": "userPut",
        "tags": [
          "User"
        ],
        "parameters": [
          {
            "name": "json",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/UserPut"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized"
          },
          "422": {
            "description": "Unprocessable Entity",
            "schema": {
              "$ref": "#/definitions/ValidationError"
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a user.",
        "operationId": "userDelete",
        "tags": [
          "User"
        ],
        "responses": {
          "204": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized"
          },
          "422": {
            "description": "Unprocessable Entity",
            "schema": {
              "$ref": "#/definitions/ValidationError"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "LoginPost": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string",
          "example": "foo"
        },
        "password": {
          "type": "string",
          "example": "bar"
        }
      }
    },
    "LoginSuccess": {
      "type": "object",
      "properties": {
        "session": {
          "type": "boolean"
        }
      }
    },
    "UserGetAll": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "attributes": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "age": {
                    "type": "string"
                  },
                  "gender": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "UserGetOne": {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "attributes": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "age": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "UserPost": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "example": "foo bar"
        },
        "age": {
          "type": "number",
          "example": 45
        },
        "gender": {
          "type": "string",
          "example": "Binary"
        }
      }
    },
    "UserPatch": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "example": "foo bar"
        },
        "age": {
          "type": "number",
          "example": 45
        },
        "gender": {
          "type": "string",
          "example": "Binary"
        }
      }
    },
    "UserPut": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "example": "biz baz"
        }
      }
    },
    "ValidationError": {
      "type": "object",
      "properties": {
        "errors": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "example": "Invalid parameter"
              },
              "details": {
                "type": "string",
                "example": "Allowed values: Numeric characters"
              },
              "source": {
                "type": "object",
                "properties": {
                  "param": {
                    "type": "string",
                    "example": "age"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
