Schema JSON ordine
Avanzato JSON Schema
Uno schema ordine completo con enum stato, array articoli e oggetto totali. Un esempio realistico per il tuo progetto o i tuoi test.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Order",
"type": "object",
"properties": {
"orderId": { "type": "string", "pattern": "^ORD-[0-9]{5}$" },
"status": {
"type": "string",
"enum": ["pending", "confirmed", "shipped", "delivered", "cancelled"]
},
"items": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"productId": { "type": "string" },
"quantity": { "type": "integer", "minimum": 1 },
"unitPrice": { "type": "number", "minimum": 0 }
},
"required": ["productId", "quantity", "unitPrice"]
}
},
"totals": {
"type": "object",
"properties": {
"subtotal": { "type": "number" },
"tax": { "type": "number" },
"shipping": { "type": "number" },
"grandTotal": { "type": "number" }
}
}
},
"required": ["orderId", "status", "items"]
} Apri nello strumento
Strumenti correlati
Altri esempi
- schema
- order
- ecommerce