Schema JSON prodotto
Intermedio JSON Schema
Un JSON Schema per validare oggetti prodotto con campi prezzo annidati e array. Un esempio realistico per il tuo progetto o i tuoi test.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Product",
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string", "minLength": 1 },
"price": {
"type": "object",
"properties": {
"amount": { "type": "number", "minimum": 0 },
"currency": { "type": "string", "pattern": "^[A-Z]{3}$" }
},
"required": ["amount", "currency"]
},
"tags": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
},
"inStock": { "type": "boolean" }
},
"required": ["id", "name", "price"]
} Apri nello strumento
Strumenti correlati
Altri esempi
- schema
- product
- ecommerce