{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Order",
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1
},
"customer": {
"$ref": "#/$defs/customer"
},
"items": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/item"
}
},
"status": {
"enum": ["pending", "paid"]
},
"note": {
"type": ["string", "null"]
}
},
"required": ["id", "customer", "items", "status"],
"additionalProperties": false,
"$defs": {
"customer": {
"title": "Customer",
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"email": {
"type": "string",
"minLength": 3
}
},
"required": ["name", "email"],
"additionalProperties": false
},
"item": {
"title": "OrderItem",
"type": "object",
"properties": {
"sku": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "integer",
"minimum": 1
},
"unitPriceCents": {
"type": "integer",
"minimum": 0
}
},
"required": ["sku", "quantity", "unitPriceCents"],
"additionalProperties": false
}
}
}