{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "properties": {
        "cluster": {
          "properties": {
            "name": {
              "default": "",
              "type": "string"
            }
          },
          "type": "object",
          "x-kubernetes-map-type": "atomic"
        },
        "dbname": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "dbname is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "name": {
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "name is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "parameters": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        "publicationReclaimPolicy": {
          "default": "retain",
          "enum": [
            "delete",
            "retain"
          ],
          "type": "string"
        },
        "target": {
          "properties": {
            "allTables": {
              "type": "boolean",
              "x-kubernetes-validations": [
                {
                  "message": "allTables is immutable",
                  "rule": "self == oldSelf"
                }
              ]
            },
            "objects": {
              "items": {
                "properties": {
                  "table": {
                    "properties": {
                      "columns": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "name": {
                        "type": "string"
                      },
                      "only": {
                        "type": "boolean"
                      },
                      "schema": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "type": "object"
                  },
                  "tablesInSchema": {
                    "type": "string"
                  }
                },
                "type": "object",
                "x-kubernetes-validations": [
                  {
                    "message": "tablesInSchema and table are mutually exclusive",
                    "rule": "(has(self.tablesInSchema) && !has(self.table)) || (!has(self.tablesInSchema) && has(self.table))"
                  }
                ]
              },
              "maxItems": 100000,
              "type": "array",
              "x-kubernetes-validations": [
                {
                  "message": "specifying a column list when the publication also publishes tablesInSchema is not supported",
                  "rule": "!(self.exists(o, has(o.table) && has(o.table.columns)) && self.exists(o, has(o.tablesInSchema)))"
                }
              ]
            }
          },
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "allTables and objects are mutually exclusive",
              "rule": "(has(self.allTables) && !has(self.objects)) || (!has(self.allTables) && has(self.objects))"
            }
          ]
        }
      },
      "required": [
        "cluster",
        "dbname",
        "name",
        "target"
      ],
      "type": "object"
    },
    "status": {
      "properties": {
        "applied": {
          "type": "boolean"
        },
        "message": {
          "type": "string"
        },
        "observedGeneration": {
          "format": "int64",
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "metadata",
    "spec"
  ],
  "type": "object"
}
