Skip to content

EspoCRM – Open Source CRM Application

11.1 KB
Raw Blame
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://www.espocrm.com/schema/metadata/clientDefs.json",
    "title": "clientDefs",
    "description": "Dynamic logic for entity types.",
    "type": "object",
    "properties": {
        "fields": {
            "type": "object",
            "description": "Fields.",
            "additionalProperties": {
                "type": "object",
                "description": "A field name.",
                "properties": {
                    "visible": {
                        "$ref": "#/definitions/dynamicLogicVisible"
                    },
                    "required": {
                        "$ref": "#/definitions/dynamicLogicRequired"
                    },
                    "readOnly": {
                        "$ref": "#/definitions/dynamicLogicReadOnly"
                    },
                    "readOnlySaved": {
                        "$ref": "#/definitions/dynamicLogicReadOnlySaved"
                    },
                    "invalid": {
                        "$ref": "#/definitions/dynamicLogicInvalid"
                    }
                }
            }
        },
        "panels": {
            "type": "object",
            "description": "Panels.",
            "additionalProperties": {
                "type": "object",
                "description": "A panel name.",
                "properties": {
                    "visible": {
                        "description": "Conditions making the panel visible.",
                        "$ref": "#/definitions/dynamicLogicVisible"
                    }
                }
            }
        },
        "options": {
            "type": "object",
            "description": "Enum options.",
            "additionalProperties": {
                "type": "array",
                "description": "A field name.",
                "items": {
                    "type": "object",
                    "properties": {
                        "optionList": {
                            "type": "array",
                            "items": {"type": "string"},
                            "description": "Options."
                        },
                        "conditionGroup": {
                            "type": "array",
                            "description": "An AND where clause.",
                            "items": {
                                "$ref": "#/definitions/dynamicLogicItem"
                            }
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "dynamicLogicVisible": {
            "type": "object",
            "description": "Conditions making the element visible.",
            "properties": {
                "conditionGroup": {
                    "description": "An AND where clause.",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dynamicLogicItem"
                    }
                }
            }
        },
        "dynamicLogicRequired": {
            "type": "object",
            "description": "Conditions making the field required.",
            "properties": {
                "conditionGroup": {
                    "type": "array",
                    "description": "An AND where clause.",
                    "items": {
                        "$ref": "#/definitions/dynamicLogicItem"
                    }
                }
            }
        },
        "dynamicLogicReadOnly": {
            "type": "object",
            "description": "Conditions making the field read-only.",
            "properties": {
                "conditionGroup": {
                    "type": "array",
                    "description": "An AND where clause.",
                    "items": {
                        "$ref": "#/definitions/dynamicLogicItem"
                    }
                }
            }
        },
        "dynamicLogicReadOnlySaved": {
            "type": "object",
            "description": "Saved-state conditions making the field read-only. As of v9.1.",
            "properties": {
                "conditionGroup": {
                    "type": "array",
                    "description": "An AND where clause.",
                    "items": {
                        "$ref": "#/definitions/dynamicLogicItem"
                    }
                }
            }
        },
        "dynamicLogicInvalid": {
            "type": "object",
            "description": "Conditions making the field invalid.",
            "properties": {
                "conditionGroup": {
                    "type": "array",
                    "description": "An AND where clause.",
                    "items": {
                        "$ref": "#/definitions/dynamicLogicItem"
                    }
                }
            }
        },
        "dynamicLogicItem": {
            "type": "object",
            "description": "A logic node.",
            "anyOf": [
                {
                    "if": {
                        "properties": {
                            "type": {
                                "anyOf": [
                                    {"const": "and"},
                                    {"const": "or"}
                                ]
                            }
                        }
                    },
                    "then": {
                        "properties": {
                            "value": {
                                "type": "array",
                                "description": "Sub-items.",
                                "items": {
                                    "$ref": "#/definitions/dynamicLogicItem"
                                }
                            }
                        },
                        "required": ["type", "value"]
                    }
                },
                {
                    "if": {
                        "properties": {
                            "type": {
                                "anyOf": [
                                    {"const": "not"}
                                ]
                            }
                        }
                    },
                    "then": {
                        "properties": {
                            "value": {
                                "type": "object",
                                "$ref": "#/definitions/dynamicLogicItem"
                            }
                        },
                        "required": ["type", "value"]
                    }
                },
                {
                    "if": {
                        "properties": {
                            "type": {
                                "anyOf": [
                                    {"const": "equals"},
                                    {"const": "notEquals"},
                                    {"const": "greaterThan"},
                                    {"const": "lessThan"},
                                    {"const": "greaterThanOrEquals"},
                                    {"const": "lessThanOrEquals"},
                                    {"const": "isEmpty"},
                                    {"const": "isNotEmpty"},
                                    {"const": "isTrue"},
                                    {"const": "isFalse"},
                                    {"const": "in"},
                                    {"const": "notIn"},
                                    {"const": "isToday"},
                                    {"const": "inFuture"},
                                    {"const": "inPast"},
                                    {"const": "contains"},
                                    {"const": "notContains"},
                                    {"const": "has"},
                                    {"const": "notHas"},
                                    {"const": "startsWith"},
                                    {"const": "endsWith"},
                                    {"const": "matches"}
                                ]
                            }
                        }
                    },
                    "then": {
                        "properties": {
                            "value": {
                                "description": "A value.",
                                "anyOf": [
                                    {"type": "string"},
                                    {"type": "boolean"},
                                    {"type": "integer"},
                                    {"type": "integer"},
                                    {"type": "number"},
                                    {"type": "null"},
                                    {
                                        "type": "array",
                                        "items": {"type": "string"}
                                    },
                                    {
                                        "type": "array",
                                        "items": {"type": "integer"}
                                    },
                                    {
                                        "type": "array",
                                        "items": {"type": "number"}
                                    }
                                ]
                            },
                            "attribute": {
                                "type": "string",
                                "description": "An attribute."
                            }
                        },
                        "required": ["type", "attribute"]
                    }
                }
            ],
            "properties": {
                "type": {
                    "description": "A type.",
                    "enum": [
                        "and",
                        "or",
                        "not",
                        "equals",
                        "notEquals",
                        "greaterThan",
                        "lessThan",
                        "greaterThanOrEquals",
                        "lessThanOrEquals",
                        "isEmpty",
                        "isNotEmpty",
                        "isTrue",
                        "isFalse",
                        "in",
                        "notIn",
                        "isToday",
                        "inFuture",
                        "inPast",
                        "contains",
                        "notContains",
                        "has",
                        "notHas",
                        "startsWith",
                        "endsWith",
                        "matches"
                    ]
                },
                "data": {
                    "type": "object",
                    "description": "Additional data. Not used for logic.",
                    "additionalProperties": true,
                    "properties": {
                        "field": {
                            "type": "string",
                            "description": "A field."
                        }
                    }
                }
            },
            "required": ["type"]
        }
    }
}