| 1 | {
|
| 2 | "$version": "1.0.0",
|
| 3 | "$id": "petstore.catalog",
|
| 4 | "$title": "Okyline Complete Petstore",
|
| 5 | "$description": "Complete schema for a pet store — animals, customers, orders and inventory",
|
| 6 | "$oky||Catalog": {
|
| 7 | "store|@|Store information": {
|
| 8 | "name|@ {2,100}|Store name": "Happy Paws Pet Shop",
|
| 9 | "email|@ ~$Email~|Contact email": "[email protected]",
|
| 10 | "phone|@ ~$Phone~|Phone number": "+15551234567",
|
| 11 | "website|~$Uri~|Website": "https://www.happypaws.com",
|
| 12 | "address|@ |Store address": "&Address",
|
| 13 | "openingHours|@ [7,7] -> {5,30}|Hours per day (Mon-Sun)": [
|
| 14 | "09:00-19:00", "09:00-19:00", "09:00-19:00",
|
| 15 | "09:00-19:00", "09:00-20:00", "10:00-18:00",
|
| 16 | "Closed"
|
| 17 | ]
|
| 18 | },
|
| 19 | "animals|@ [1,*] -> !|Animal catalog": [
|
| 20 | {
|
| 21 | "id|# ~$AnimalId~|Animal identifier": "ANM-00421",
|
| 22 | "name|@ {2,50}|Animal name": "Caramel",
|
| 23 | "species|@ ($SPECIES)|Species": "DOG",
|
| 24 | "breed|@ {2,80}|Breed": "Golden Retriever",
|
| 25 | "sex|@ ('M','F')|Sex": "M",
|
| 26 | "birthDate|@ ~$Date~|Date of birth": "2024-03-15",
|
| 27 | "color|@ {2,30}|Color": "Golden",
|
| 28 | "weight|@ (>0)|Weight in kg": 12.5,
|
| 29 | "vaccinated|@|Vaccinated": true,
|
| 30 | "microchipped|@|Microchipped": true,
|
| 31 | "status|@ ($ANIMAL_STATUS)|Status": "AVAILABLE",
|
| 32 | "price|@ (>0)|Price in USD": 1500,
|
| 33 | "description|{0,500}|Description": "Adorable playful puppy, very sociable with children",
|
| 34 | "photos|[1,10] -> ~$Uri~|Photo URLs": [
|
| 35 | "https://cdn.happypaws.com/photos/anm-00421-1.jpg"
|
| 36 | ],
|
| 37 | "tags|[0,10] -> {2,20}!|Tags": [
|
| 38 | "puppy",
|
| 39 | "playful",
|
| 40 | "family-friendly"
|
| 41 | ],
|
| 42 | "$appliedIf species": {
|
| 43 | "('DOG')": {
|
| 44 | "size|@ ($DOG_SIZE)|Size category": "LARGE"
|
| 45 | },
|
| 46 | "('CAT')": {
|
| 47 | "indoor|@|Indoor cat": true
|
| 48 | },
|
| 49 | "('FISH')": {
|
| 50 | "waterType|@ ('FRESH','SALT')|Water type": "FRESH",
|
| 51 | "tankMinLiters|@ (>0)|Minimum tank volume (L)": 100
|
| 52 | },
|
| 53 | "('BIRD')": {
|
| 54 | "canFly|@|Can fly": true,
|
| 55 | "songType|('SINGER','TALKER','QUIET')|Song type": "SINGER"
|
| 56 | },
|
| 57 | "('REPTILE')": {
|
| 58 | "venomous|@|Venomous": false,
|
| 59 | "terrariumTemp|@ (15..40)|Terrarium temperature °C": 28
|
| 60 | }
|
| 61 | }
|
| 62 | }
|
| 63 | ],
|
| 64 | "products|@ [1,*] -> !|Product catalog": [
|
| 65 | {
|
| 66 | "sku|# ~$Sku~|Product reference": "PRD-00987",
|
| 67 | "name|@ {2,150}|Product name": "Premium Adult Dog Kibble 12kg",
|
| 68 | "category|@ ($PRODUCT_CATEGORY)|Category": "FOOD",
|
| 69 | "targetSpecies|@ [1,*] -> ($SPECIES)!|Target species": [
|
| 70 | "DOG"
|
| 71 | ],
|
| 72 | "brand|@ {2,50}|Brand": "Royal Canin",
|
| 73 | "price|@ (>0)|Unit price incl. tax": 54.99,
|
| 74 | "stock|@ (>=0)|Quantity in stock": 42,
|
| 75 | "reorderThreshold|@ (>=0)|Reorder threshold": 10,
|
| 76 | "description|{0,500}|Description": "Complete and balanced nutrition for adult dogs",
|
| 77 | "active|@|Product active": true,
|
| 78 | "$requiredIf active(true)": [
|
| 79 | "price",
|
| 80 | "stock"
|
| 81 | ]
|
| 82 | }
|
| 83 | ],
|
| 84 | "customers|@ [1,*] -> !|Customers": [
|
| 85 | {
|
| 86 | "id|# ~$CustomerId~|Customer identifier": "CLI-10042",
|
| 87 | "firstName|@ {2,50}|First name": "Emily",
|
| 88 | "lastName|@ {2,50}|Last name": "Johnson",
|
| 89 | "email|@ ~$Email~|Email": "[email protected]",
|
| 90 | "phone|~$Phone~|Phone": "+15559876543",
|
| 91 | "address| |Address": "&Address",
|
| 92 | "loyaltyPoints|@ (>=0)|Loyalty points": 350,
|
| 93 | "memberSince|@ ~$Date~|Member since": "2023-06-01",
|
| 94 | "tier|@ ($CUSTOMER_TIER)|Loyalty tier": "GOLD",
|
| 95 | "pets|[0,20]|Customer's pets": [
|
| 96 | {
|
| 97 | "name|@ {1,50}|Pet name": "Luna",
|
| 98 | "species|@ ($SPECIES)|Species": "CAT",
|
| 99 | "breed|{2,80}|Breed": "Persian",
|
| 100 | "birthYear|(2000..2026)|Birth year": 2021
|
| 101 | }
|
| 102 | ]
|
| 103 | }
|
| 104 | ],
|
| 105 | "orders|@ [1,*] -> !|Orders": [
|
| 106 | {
|
| 107 | "orderId|# ~$OrderId~|Order number": "ORD-20250512-001",
|
| 108 | "customerId|@ ~$CustomerId~|Customer": "CLI-10042",
|
| 109 | "createdAt|@ ~$DateTime~|Creation date": "2025-05-12T10:30:00Z",
|
| 110 | "status|@ ($ORDER_STATUS)|Status": "CONFIRMED",
|
| 111 | "type|@ ($ORDER_TYPE)|Order type": "PRODUCT",
|
| 112 | "$appliedIf type": {
|
| 113 | "('PRODUCT')": {
|
| 114 | "lines|@ [1,50] -> !|Order lines": [
|
| 115 | {
|
| 116 | "sku|# ~$Sku~|Reference": "PRD-00987",
|
| 117 | "productName|@ {2,150}|Product": "Premium Adult Dog Kibble 12kg",
|
| 118 | "quantity|@ (1..999)|Quantity": 2,
|
| 119 | "unitPrice|@ (>0)|Unit price": 54.99,
|
| 120 | "lineTotal|@ (%LineTotal)|Line total": 109.98
|
| 121 | }
|
| 122 | ]
|
| 123 | },
|
| 124 | "('ADOPTION')": {
|
| 125 | "animalId|@ ~$AnimalId~|Adopted animal": "ANM-00421",
|
| 126 | "adoptionFee|@ (>0)|Adoption fee": 1500,
|
| 127 | "adoptionContract|@ ~$Uri~|Contract link": "https://docs.happypaws.com/contracts/ORD-20250512-001.pdf"
|
| 128 | },
|
| 129 | "('SERVICE')": {
|
| 130 | "serviceType|@ ($SERVICE_TYPE)|Service type": "GROOMING",
|
| 131 | "scheduledAt|@ ~$DateTime~|Appointment date": "2025-05-15T14:00:00Z",
|
| 132 | "duration|@ (15..480)|Duration in minutes": 60,
|
| 133 | "serviceFee|@ (>0)|Service fee": 45
|
| 134 | }
|
| 135 | },
|
| 136 | "payment|@|Payment": {
|
| 137 | "method|@ ($PAYMENT_METHOD)|Payment method": "CARD",
|
| 138 | "status|@ ($PAYMENT_STATUS)|Payment status": "PAID",
|
| 139 | "paidAt|~$DateTime~|Payment date": "2025-05-12T10:32:00Z",
|
| 140 | "transactionId|~$TransactionId~|Transaction ref": "TXN-A1B2C3D4E5F6",
|
| 141 | "$requiredIf status('PAID')": [
|
| 142 | "paidAt",
|
| 143 | "transactionId"
|
| 144 | ],
|
| 145 | "$forbiddenIf status('PENDING')": [
|
| 146 | "paidAt",
|
| 147 | "transactionId"
|
| 148 | ]
|
| 149 | },
|
| 150 | "amounts|@|Amounts": {
|
| 151 | "subtotal|@ (%CheckSubtotal)|Subtotal": 109.98,
|
| 152 | "discount|@ (>=0)|Discount": 5.5,
|
| 153 | "taxRate|@ (0.05,0.125,0.2)|Tax rate": 0.2,
|
| 154 | "total|@ (%ValidTotal)|Total incl. tax": 126.48
|
| 155 | },
|
| 156 | "notes|{0,500}|Internal notes": "Loyal customer, include a free sample"
|
| 157 | }
|
| 158 | ]
|
| 159 | },
|
| 160 | "$defs": {
|
| 161 | "Address": {
|
| 162 | "street|@ {5,200}|Street": "742 Evergreen Terrace",
|
| 163 | "complement|{0,100}|Address line 2": "Suite 4B",
|
| 164 | "postalCode|@ ~^[0-9]{5}$~|Zip code": "90210",
|
| 165 | "city|@ {2,100}|City": "Beverly Hills",
|
| 166 | "state|{2,50}|State": "California",
|
| 167 | "country|@ ~^[A-Z]{2}$~|Country (ISO)": "US"
|
| 168 | }
|
| 169 | },
|
| 170 | "$format": {
|
| 171 | "Phone": "^\\+[0-9]{10,14}$",
|
| 172 | "AnimalId": "^ANM-[0-9]{5}$",
|
| 173 | "Sku": "^PRD-[0-9]{5}$",
|
| 174 | "CustomerId": "^CLI-[0-9]{5}$",
|
| 175 | "OrderId": "^ORD-[0-9]{8}-[0-9]{3}$",
|
| 176 | "TransactionId": "^TXN-[A-Z0-9]{12}$"
|
| 177 | },
|
| 178 | "$nomenclature": {
|
| 179 | "SPECIES": "DOG, CAT, BIRD, FISH, REPTILE, RODENT, RABBIT",
|
| 180 | "ANIMAL_STATUS": "AVAILABLE, RESERVED, ADOPTED, MEDICAL_HOLD",
|
| 181 | "DOG_SIZE": "MINI, SMALL, MEDIUM, LARGE, GIANT",
|
| 182 | "PRODUCT_CATEGORY": "FOOD, TREATS, TOYS, HEALTH, HYGIENE, HABITAT, ACCESSORIES",
|
| 183 | "CUSTOMER_TIER": "BRONZE, SILVER, GOLD, PLATINUM",
|
| 184 | "ORDER_STATUS": "DRAFT, CONFIRMED, PROCESSING, SHIPPED, DELIVERED, CANCELLED",
|
| 185 | "ORDER_TYPE": "PRODUCT, ADOPTION, SERVICE",
|
| 186 | "SERVICE_TYPE": "GROOMING, VETERINARY, TRAINING, BOARDING, WALKING",
|
| 187 | "PAYMENT_METHOD": "CARD, CASH, TRANSFER, CHECK",
|
| 188 | "PAYMENT_STATUS": "PENDING, PAID, FAILED, REFUNDED"
|
| 189 | },
|
| 190 | "$compute": {
|
| 191 | "LineTotal": "lineTotal == quantity * unitPrice",
|
| 192 | "CheckSubtotal": "subtotal == (sum(parent.lines, lineTotal) ?? 0) + (parent.adoptionFee ?? 0) + (parent.serviceFee ?? 0)",
|
| 193 | "ValidTotal": "total > 0 && total == round((subtotal * (1 + taxRate)) - discount,2)"
|
| 194 | }
|
| 195 | } |