swagger: "2.0"
info:
  description: "Repo Bundler Service"
  version: "1.0.0"
  title: "repo-bundler"
  contact:
    name: "Infra"
    email: "infrateam@zoox.com"
    url: "https://git.zooxlabs.com/zooxco/driving"

basePath: "/api/v1"

schemes:
  - "https"

paths:
  /github-webhook:
    post:
      summary: "Incoming webhook from GitHub"
      description: ""
      operationId: "experimental.marczych.repo_bundler.server.github_webhook"
      produces:
        - "application/json"
      parameters:
        - in: "body"
          name: "payload"
          schema:
            $ref: "#/definitions/GithubWebhook"
      responses:
        "201":
          description: "Successfully bundled repo"
          schema:
            $ref: "#/definitions/BundleRepoSuccess"
        "204":
          description: "No content"
        "422":
          description: "Invalid parameter"
          schema:
            $ref: "#/definitions/ErrorResponse"
        "500":
          description: "Internal server error"
          schema:
            $ref: "#/definitions/ErrorResponse"
  /health/status:
    get:
      summary: "Health check"
      description: ""
      operationId: "experimental.marczych.repo_bundler.server.health"
      responses:
        "200":
          description: "Healthy"
          schema:
            $ref: "#/definitions/HealthResponse"
        "500":
          description: "Unhealthy"
          schema:
            $ref: "#/definitions/HealthResponse"

definitions:
  BundleRepoSuccess:
    type: "object"
    properties:
      message:
        description: "A message indicating success"
        type: "string"

  # This takes many different forms and varies greatly based on the type of
  # event.
  GithubWebhook:
    type: "object"
    additionalProperties: true

  HealthResponse:
    type: "object"
    properties:
      message:
        description: "A message describing the health"
        type: "string"

  ErrorResponse:
    type: "object"
    properties:
      message:
        description: "A message describing the error"
        type: "string"
