{
  "$async": true,
  "$id": "https://www.sap.com/products/data-warehouse-cloud/cli/schemas/discovery.json",
  "title": "Command-Line Interface Commands",
  "description": "This document describes the schema for the discovery document command-line interfaces.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "openapi": {
      "const": "3.0.3"
    },
    "info": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "contact": {
          "$ref": "#/$defs/reference"
        },
        "license": {
          "$ref": "#/$defs/reference"
        },
        "version": {
          "type": "string",
          "pattern": "^[0-9]{1,4}\\.[0-9]{1,2}(\\.[0-9]{1,2})?$"
        },
        "x-document-version": {
          "type": "string",
          "pattern": "^[0-9]{1,4}\\.[0-9]{1,2}(\\.[0-9]{1,2})?$"
        }
      },
      "required": [
        "title",
        "description",
        "contact",
        "license",
        "version",
        "x-document-version"
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "$ref": "#/$defs/lowercaseString"
          },
          "description": {
            "$ref": "#/$defs/text"
          }
        },
        "required": ["name", "description"]
      }
    },
    "externalDocs": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "required": ["description", "url"]
    },
    "paths": {
      "type": "object",
      "minProperties": 1,
      "patternProperties": {
        "^[a-z/0-9]*$": {
          "type": "object",
          "minProperties": 1,
          "patternProperties": {
            "^(post|put|get|delete|patch|head)$": {
              "allOf": [
                {
                  "$ref": "#/$defs/deprecationProperties"
                },
                {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "operationId": {
                      "oneOf": [
                        {
                          "$ref": "#/$defs/lowercaseString"
                        },
                        {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "oneOf": [
                              {
                                "$ref": "#/$defs/lowercaseString"
                              },
                              {
                                "$ref": "#/$defs/operationAlias"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    "summary": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "x-user-to-confirm": {
                      "type": "string"
                    },
                    "x-read-command": {
                      "type": "string"
                    },
                    "parameters": {
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/parameters"
                      }
                    },
                    "requestBody": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "description": {
                          "type": "string"
                        },
                        "content": {
                          "oneOf": [
                            {
                              "$ref": "#/$defs/SingleContentType"
                            },
                            {
                              "$ref": "#/$defs/MultipleContentTypesIncludingCommands"
                            }
                          ]
                        }
                      },
                      "required": ["description", "content", "required"]
                    },
                    "responses": {
                      "type": "object",
                      "minProperties": 1,
                      "patternProperties": {
                        "^[2-5][0-9]{2}$": {
                          "oneOf": [
                            {
                              "$ref": "#/$defs/component"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "description": {
                                  "type": "string"
                                }
                              },
                              "required": ["description"]
                            }
                          ]
                        }
                      }
                    }
                  },
                  "required": ["operationId", "responses"]
                }
              ]
            }
          }
        }
      }
    },
    "components": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schemas": {
          "type": "object",
          "patternProperties": {
            ".*": {}
          }
        },
        "parameters": {
          "type": "object",
          "patternProperties": {
            ".*": {
              "$ref": "#/$defs/parameters"
            }
          }
        }
      }
    }
  },
  "required": [
    "openapi",
    "info",
    "tags",
    "externalDocs",
    "paths",
    "components"
  ],
  "$defs": {
    "SingleContentType": {
      "type": "object",
      "additionalProperties": true,
      "minProperties": 1,
      "maxProperties": 1,
      "patternProperties": {
        "^application/[a-z.+;=0-9]*": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "$ref": {
                  "type": "string"
                }
              },
              "required": ["$ref"]
            }
          },
          "required": ["schema"]
        }
      }
    },
    "MultipleContentTypesIncludingCommands": {
      "type": "object",
      "additionalProperties": true,
      "minProperties": 1,
      "patternProperties": {
        "^application/[a-z.+;=0-9]*": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "x-command": {
              "type": "string"
            },
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "$ref": {
                  "type": "string"
                }
              },
              "required": ["$ref"]
            }
          },
          "required": ["schema", "x-command"]
        }
      }
    },
    "parameters": {
      "oneOf": [
        {
          "$ref": "#/$defs/component"
        },
        {
          "$ref": "#/$defs/parameter"
        }
      ]
    },
    "parameter": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "in": {
          "type": "string",
          "enum": ["query", "header", "path"]
        },
        "description": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "allowEmptyValue": {
          "type": "boolean"
        },
        "schema": {
          "oneOf": [
            {
              "$ref": "#/$defs/component"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "oneOf": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 2,
                  "items": {
                    "oneOf": [
                      {
                        "$ref": "#/$defs/component"
                      },
                      {
                        "$ref": "#/$defs/scalarType"
                      }
                    ]
                  }
                }
              },
              "required": ["oneOf"]
            },
            {
              "$ref": "#/$defs/scalarType"
            }
          ]
        }
      },
      "required": ["name", "in", "description", "schema"]
    },
    "scalarType": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["boolean", "string", "number"]
        }
      },
      "required": ["type"]
    },
    "component": {
      "type": "object",
      "properties": {
        "$ref": {
          "type": "string"
        }
      },
      "required": ["$ref"]
    },
    "text": {
      "type": "string",
      "pattern": "^[a-zA-Z\\s-]*$"
    },
    "lowercaseString": {
      "type": "string",
      "pattern": "^[a-z\\s-]*$"
    },
    "reference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "required": ["name", "url"]
    },
    "deprecationProperties": {
      "type": "object",
      "properties": {
        "deprecated": {
          "type": "boolean"
        },
        "x-deprecated-with-wave": {
          "type": "string"
        },
        "x-decommissioned-after-wave": {
          "type": "string"
        },
        "x-deprecation-new-command": {
          "type": "string"
        },
        "x-deprecation-sap-help-url": {
          "type": "string"
        }
      }
    },
    "operationAlias": {
      "allOf": [
        {
          "$ref": "#/$defs/deprecationProperties"
        },
        {
          "type": "object",
          "properties": {
            "operationId": {
              "$ref": "#/$defs/lowercaseString"
            }
          },
          "required": ["operationId"]
        }
      ]
    }
  }
}
