{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/datagalaxy/json-schema/datagalaxy-create-rule-command-schema.json",
  "title": "CreateRuleCommand",
  "description": "Create rule.\nYou can reference an entity using either a versionId, entityPath and entityTypePath, or an entityId.\nHere's an example using versionId, entityPath and entityTypePath:\n{\n  \"statement\": \"Client code must be unique\",\n  \"code\": \"client_code_unique\",\n  \"type\": \"uniqueness\",\n  \"versionId\": \"4aeae8a9-0c0d-4fa9-a8af-cb529bb64fa2\",\n  \"entityPath\": \"\\\\Zoho\\\\CRM\\\\Client\",\n  \"entityTypePath\": \"\\\\Relational\\\\Model\\\\Table\"\n}\nHere's an example using entityId:\n{\n  \"statement\": \"Invoice must include reference\",\n  \"code\": \"invoice_missing_reference\",\n  \"type\": \"completeness\",\n  \"entityId\": \"bd95bbbf-16f8-4618-ab47-4ee835563304:52e35910-c3d0-45ce-b330-a9db28e5dc73\",\n}\n            ",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/datagalaxy-openapi.yml#/components/schemas/CreateRuleCommand",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "statement": {
      "type": "string",
      "description": "Statement of the rule in natural language. Example: Client code must be unique"
    },
    "code": {
      "type": [
        "string",
        "null"
      ],
      "description": "External identifier of the rule (must be unique in a workspace). Example: 123_client_code_unique"
    },
    "versionId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Workspace version unique identifier. Example: 22b5dc8c-8a19-48fa-99e3-a3da9bfe0068",
      "format": "guid"
    },
    "entityId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Entity unique identifier (composed of the workspace UUID and the object UUID separated by a colon). Example: bd95bbbf-16f8-4618-ab47-4ee835563304:52e35910-c3d0-45ce-b330-a9db28e5dc73"
    },
    "type": {
      "description": "Rule type. Must be one of the seven dimensions of data quality assessment: completeness, accuracy, consistency, validity, uniqueness, integrity or timeliness",
      "nullable": true,
      "oneOf": [
        {
          "$ref": "#/$defs/RuleTypeEnum"
        }
      ]
    },
    "entityPath": {
      "type": [
        "string",
        "null"
      ],
      "description": "Entity path using backslash (\\\\) as a separator. Example: \\\\Zoho\\\\CRM\\\\Client. Please note that \\\\ must be escaped in JSON string (i.e., \"\\\\\\\\Zoho\\\\\\\\CRM\\\\\\\\Client\")"
    },
    "entityTypePath": {
      "type": [
        "string",
        "null"
      ],
      "description": "Entity type path using backslash (\\\\) as a separator. Example: \\\\Relational\\\\Model\\\\Table. Please note that \\\\ must be escaped in JSON string (i.e., \"\\\\\\\\Relational\\\\\\\\Model\\\\\\\\Table\")"
    },
    "fieldIds": {
      "type": [
        "array",
        "null"
      ],
      "description": "List of field identifiers associated with the rule.",
      "items": {
        "type": "string"
      }
    },
    "severity": {
      "description": "Severity level of the rule.",
      "nullable": true,
      "oneOf": [
        {
          "$ref": "#/$defs/SeverityEnum"
        }
      ]
    },
    "category": {
      "type": [
        "string",
        "null"
      ],
      "description": "Category of the rule."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Description of the rule."
    },
    "externalUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "External URL for more information about the rule."
    }
  },
  "$defs": {
    "RuleTypeEnum": {
      "type": "string",
      "description": "Data quality rule type using the 7 dimensions of data quality assessment.",
      "x-enumNames": [
        "Completeness",
        "Accuracy",
        "Consistency",
        "Validity",
        "Uniqueness",
        "Integrity",
        "Timeliness"
      ],
      "enum": [
        "Completeness",
        "Accuracy",
        "Consistency",
        "Validity",
        "Uniqueness",
        "Integrity",
        "Timeliness"
      ]
    },
    "SeverityEnum": {
      "type": "string",
      "description": "Data quality rule severity based on the four dimensions of sifflet data quality assessment.",
      "x-enumNames": [
        "Low",
        "Moderate",
        "High",
        "Critical"
      ],
      "enum": [
        "Low",
        "Moderate",
        "High",
        "Critical"
      ]
    }
  }
}