{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/openstatus/latest.json",
  "x-lintel": {
    "source": "https://github.com/openstatusHQ/json-schema/releases/download/v1.0.0/schema.json",
    "sourceSha256": "b53556f1fb4eaffa6ec654b472b7c645a035871fbc424e7002797ae365a2b4ec",
    "fileMatch": [
      "openstatus.json",
      "openstatus.yml",
      "openstatus.yaml",
      "openstatus.toml"
    ],
    "parsers": [
      "json",
      "toml",
      "yaml"
    ]
  },
  "type": "object",
  "additionalProperties": {
    "anyOf": [
      {
        "description": "HTTP Request Schema",
        "type": "object",
        "properties": {
          "name": {
            "description": "Name of the monitor",
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "retry": {
            "description": "Number of retries to attempt",
            "examples": [
              1,
              3,
              5
            ],
            "default": 3,
            "type": "number",
            "minimum": 1,
            "maximum": 10
          },
          "degradedAfter": {
            "description": "Time in milliseconds to wait before marking the request as degraded",
            "examples": [
              30000
            ],
            "default": 30000,
            "type": "number",
            "minimum": 0
          },
          "timeout": {
            "description": "Time in milliseconds to wait before marking the request as timed out",
            "examples": [
              45000
            ],
            "default": 45000,
            "type": "number",
            "minimum": 0
          },
          "frequency": {
            "enum": [
              "30s",
              "1m",
              "5m",
              "10m",
              "30m",
              "1h"
            ]
          },
          "active": {
            "description": "Whether the monitor is active",
            "default": false,
            "type": "boolean"
          },
          "public": {
            "description": "Whether the monitor is public",
            "default": false,
            "type": "boolean"
          },
          "regions": {
            "description": "Regions to run the request in",
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "enum": [
                    "ams",
                    "arn",
                    "atl",
                    "bog",
                    "bom",
                    "bos",
                    "cdg",
                    "den",
                    "dfw",
                    "ewr",
                    "eze",
                    "fra",
                    "gdl",
                    "gig",
                    "gru",
                    "hkg",
                    "iad",
                    "jnb",
                    "lax",
                    "lhr",
                    "mad",
                    "mia",
                    "nrt",
                    "ord",
                    "otp",
                    "phx",
                    "qro",
                    "scl",
                    "sjc",
                    "sea",
                    "sin",
                    "syd",
                    "waw",
                    "yul",
                    "yyz"
                  ]
                },
                {
                  "const": "private"
                }
              ]
            }
          },
          "kind": {
            "const": "http"
          },
          "assertions": {
            "description": "Assertions to run on the response",
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "examples": [
                    {
                      "kind": "statusCode",
                      "compare": "eq",
                      "target": 200
                    },
                    {
                      "kind": "statusCode",
                      "compare": "not_eq",
                      "target": 404
                    },
                    {
                      "kind": "statusCode",
                      "compare": "gt",
                      "target": 300
                    }
                  ],
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "statusCode"
                    },
                    "compare": {
                      "description": "Comparison operator",
                      "examples": [
                        "eq",
                        "not_eq",
                        "gt",
                        "gte",
                        "lt",
                        "lte"
                      ],
                      "enum": [
                        "eq",
                        "not_eq",
                        "gt",
                        "gte",
                        "lt",
                        "lte"
                      ]
                    },
                    "target": {
                      "description": "Status code to assert",
                      "examples": [
                        200,
                        404,
                        418,
                        500
                      ],
                      "type": "number"
                    }
                  },
                  "required": [
                    "kind",
                    "compare",
                    "target"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "header"
                    },
                    "compare": {
                      "description": "Comparison operator",
                      "examples": [
                        "eq",
                        "not_eq",
                        "contains",
                        "not_contains"
                      ],
                      "enum": [
                        "contains",
                        "not_contains",
                        "eq",
                        "not_eq",
                        "empty",
                        "not_empty",
                        "gt",
                        "gte",
                        "lt",
                        "lte"
                      ]
                    },
                    "key": {
                      "description": "Header key to assert",
                      "examples": [
                        "Content-Type",
                        "X-Request-ID"
                      ],
                      "type": "string"
                    },
                    "target": {
                      "description": "Header value to assert",
                      "examples": [
                        "application/json",
                        "text/html"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "compare",
                    "key",
                    "target"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "textBody"
                    },
                    "compare": {
                      "description": "Comparison operator",
                      "examples": [
                        "eq",
                        "not_eq",
                        "contains",
                        "not_contains"
                      ],
                      "enum": [
                        "contains",
                        "not_contains",
                        "eq",
                        "not_eq",
                        "empty",
                        "not_empty",
                        "gt",
                        "gte",
                        "lt",
                        "lte"
                      ]
                    },
                    "target": {
                      "description": "Text body to assert",
                      "examples": [
                        "Hello, world!",
                        "404 Not Found"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "compare",
                    "target"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "request": {
            "description": "The HTTP Request we are sending",
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "GET",
                  "POST",
                  "PUT",
                  "DELETE",
                  "PATCH",
                  "HEAD",
                  "OPTIONS"
                ]
              },
              "url": {
                "description": "URL to request",
                "examples": [
                  "https://openstat.us",
                  "https://www.openstatus.dev"
                ],
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "body": {
                "description": "Body to send with the request",
                "examples": [
                  "{ \"key\": \"value\" }",
                  "Hello World"
                ],
                "type": "string"
              }
            },
            "required": [
              "method",
              "url",
              "headers"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "frequency",
          "regions",
          "kind",
          "request"
        ],
        "additionalProperties": false
      },
      {
        "description": "TCP Request Schema",
        "type": "object",
        "properties": {
          "name": {
            "description": "Name of the monitor",
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "retry": {
            "description": "Number of retries to attempt",
            "examples": [
              1,
              3,
              5
            ],
            "default": 3,
            "type": "number",
            "minimum": 1,
            "maximum": 10
          },
          "degradedAfter": {
            "description": "Time in milliseconds to wait before marking the request as degraded",
            "examples": [
              30000
            ],
            "default": 30000,
            "type": "number",
            "minimum": 0
          },
          "timeout": {
            "description": "Time in milliseconds to wait before marking the request as timed out",
            "examples": [
              45000
            ],
            "default": 45000,
            "type": "number",
            "minimum": 0
          },
          "frequency": {
            "enum": [
              "30s",
              "1m",
              "5m",
              "10m",
              "30m",
              "1h"
            ]
          },
          "active": {
            "description": "Whether the monitor is active",
            "default": false,
            "type": "boolean"
          },
          "public": {
            "description": "Whether the monitor is public",
            "default": false,
            "type": "boolean"
          },
          "regions": {
            "description": "Regions to run the request in",
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "enum": [
                    "ams",
                    "arn",
                    "atl",
                    "bog",
                    "bom",
                    "bos",
                    "cdg",
                    "den",
                    "dfw",
                    "ewr",
                    "eze",
                    "fra",
                    "gdl",
                    "gig",
                    "gru",
                    "hkg",
                    "iad",
                    "jnb",
                    "lax",
                    "lhr",
                    "mad",
                    "mia",
                    "nrt",
                    "ord",
                    "otp",
                    "phx",
                    "qro",
                    "scl",
                    "sjc",
                    "sea",
                    "sin",
                    "syd",
                    "waw",
                    "yul",
                    "yyz"
                  ]
                },
                {
                  "const": "private"
                }
              ]
            }
          },
          "kind": {
            "const": "tcp"
          },
          "request": {
            "type": "object",
            "properties": {
              "host": {
                "examples": [
                  "example.com",
                  "localhost"
                ],
                "description": "Host to connect to",
                "type": "string"
              },
              "port": {
                "description": "Port to connect to",
                "examples": [
                  80,
                  443,
                  1337
                ],
                "type": "number"
              }
            },
            "required": [
              "host",
              "port"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "frequency",
          "regions",
          "kind",
          "request"
        ],
        "additionalProperties": false
      }
    ]
  },
  "propertyNames": {
    "type": "string"
  }
}
