# Document FK
# Ссылка на документ в другой коллекции. Требует указания коллекции документов.
{
"type": "string",
"x-document-collection": "users"
}
# Directory FK
# Ссылка на элемент каталога. Требует указания коллекции каталога и параметра.
{
"type": "string",
"x-directory-collection": "departments",
"x-directory-param": "name"
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "User",
"description": "Схема данных пользователя",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Уникальный идентификатор",
"x-index": "single_field"
},
"username": {
"type": "string",
"minLength": 3,
"maxLength": 50,
"pattern": "^[a-zA-Z0-9_]+$",
"description": "Имя пользователя",
"x-index": "single_field"
},
"email": {
"type": "string",
"format": "email",
"description": "Email адрес",
"x-index": "single_field"
},
"active": {
"type": "boolean",
"description": "Активность пользователя"
}
},
"required": ["id", "username", "email"],
"additionalProperties": false
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Order",
"description": "Схема заказа",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"x-index": "single_field"
},
"customerId": {
"type": "string",
"x-document-collection": "customers",
"x-index": "single_field"
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"productId": {
"type": "string",
"x-document-collection": "products"
},
"quantity": {
"type": "integer",
"minimum": 1
},
"price": {
"type": "number",
"minimum": 0
}
},
"required": ["productId", "quantity", "price"],
"additionalProperties": false
},
"minItems": 1
},
"status": {
"type": "string",
"enum": ["pending", "processing", "shipped", "delivered", "cancelled"],
"x-index": "single_field"
}
},
"required": ["id", "customerId", "items", "status"],
"additionalProperties": false
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Employee",
"description": "Схема сотрудника",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"x-index": "single_field"
},
"firstName": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"lastName": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"departmentId": {
"type": "string",
"x-directory-collection": "departments",
"x-directory-param": "id",
"description": "Ссылка на отдел",
"x-index": "single_field"
},
"managerId": {
"type": "string",
"x-document-collection": "employees",
"description": "Ссылка на руководителя",
"x-index": "single_field"
},
"skills": {
"type": "array",
"items": {
"type": "string",
"x-directory-collection": "skills",
"x-directory-param": "name"
},
"uniqueItems": true
}
},
"required": ["id", "firstName", "lastName", "departmentId"],
"additionalProperties": false
}
# Пример сообщения об ошибке совместимости:
# Обнаружены несовместимые изменения:
• Изменен тип поля 'age' с 'string' на 'integer'
• Удалено обязательное поле 'email'
• Добавлено обязательное поле 'newField'
# Эти изменения могут нарушить работу с существующими данными.
Продолжить с принудительным обновлением?