Schema JSON produit
Intermediaire JSON Schema
Un JSON Schema pour valider les objets produit avec champs de prix imbriques et tableaux. Un exemple realiste pour votre projet ou vos tests.
{
"$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"]
} Ouvrir dans l'outil
Outils associes
Plus d'exemples
- schema
- product
- ecommerce