{
  "openapi": "3.1.0",
  "info": {
    "title": "ohkami-worker-with-openapi",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "http://localhost:8787",
      "description": "local dev"
    }
  ],
  "paths": {
    "/api/tweets": {
      "get": {
        "operationId": "list_tweets",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Tweet"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Modyfing other user"
          },
          "500": {
            "description": "Worker's internal error"
          }
        }
      },
      "post": {
        "operationId": "post_tweet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string"
                  }
                },
                "required": [
                  "content"
                ]
              }
            }
          }
        },
        "security": [
          {
            "tokenAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tweet"
                }
              }
            }
          },
          "403": {
            "description": "Modyfing other user"
          },
          "500": {
            "description": "Worker's internal error"
          }
        }
      }
    },
    "/api/users": {
      "get": {
        "operationId": "list_users",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserProfile"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Modyfing other user"
          },
          "500": {
            "description": "Worker's internal error"
          }
        }
      },
      "post": {
        "operationId": "sign_up",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "token": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "token"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProfile"
                }
              }
            }
          },
          "403": {
            "description": "Modyfing other user"
          },
          "500": {
            "description": "Worker's internal error"
          }
        }
      }
    },
    "/api/users/{id}": {
      "get": {
        "operationId": "show_user_profile",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserProfile"
                }
              }
            }
          },
          "403": {
            "description": "Modyfing other user"
          },
          "500": {
            "description": "Worker's internal error"
          }
        }
      },
      "put": {
        "operationId": "edit_profile",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "age": {
                    "type": "integer",
                    "format": "uint8"
                  },
                  "location": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "tokenAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "403": {
            "description": "Modyfing other user"
          },
          "500": {
            "description": "Worker's internal error"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "security": [
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Tweet": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "posted_at": {
            "type": "string"
          },
          "user_id": {
            "type": "integer",
            "format": "int32"
          },
          "user_name": {
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "user_name",
          "content",
          "posted_at"
        ]
      },
      "UserProfile": {
        "type": "object",
        "properties": {
          "age": {
            "type": "integer",
            "format": "uint8"
          },
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "location": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ]
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      },
      "tokenAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JSON (user_id, token)"
      }
    }
  }
}