Редактор JSON
Строка: 1
Символов: 0
Структура схемы
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Order",
"description": "Заказ покупателя",
"type": "object",
"properties": {
"orderId": {
"type": "string",
"minLength": 1
},
"customer": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 2
},
"email": {
"type": "string",
"format": "email"
}
},
"required": ["name", "email"],
"additionalProperties": true
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"productId": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "integer",
"minimum": 1
},
"price": {
"type": "number",
"minimum": 0
}
},
"required": ["productId", "quantity"],
"additionalProperties": true
},
"minItems": 1
},
"status": {
"type": "string",
"enum": ["pending", "processing", "shipped", "delivered", "cancelled"]
}
},
"required": ["orderId", "customer", "items"],
"additionalProperties": true
}
Результат валидации
Результат проверки появится здесь
Пример JSON для схемы
{
"orderId": "ORD-2024-00123",
"customer": {
"name": "Алексей Смирнов",
"email": "alexey@example.com"
},
"items": [
{
"productId": "PROD-001",
"quantity": 2,
"price": 1500.00
}
],
"status": "pending"
}
Этот пример соответствует выбранной схеме