shapecraft 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CLAUDE.md +227 -0
  2. package/README.md +22 -0
  3. package/apps/cli/node_modules/.bin/prettier +21 -0
  4. package/apps/cli/node_modules/.bin/tsc +21 -0
  5. package/apps/cli/node_modules/.bin/tsserver +21 -0
  6. package/apps/cli/node_modules/.bin/tsx +21 -0
  7. package/apps/cli/node_modules/.bin/vitest +21 -0
  8. package/apps/cli/package.json +47 -0
  9. package/apps/cli/src/index.ts +98 -0
  10. package/apps/cli/tsconfig.cjs.json +10 -0
  11. package/apps/cli/tsconfig.esm.json +10 -0
  12. package/apps/cli/tsconfig.json +22 -0
  13. package/package.json +16 -0
  14. package/packages/core/node_modules/.bin/prettier +21 -0
  15. package/packages/core/node_modules/.bin/tsc +21 -0
  16. package/packages/core/node_modules/.bin/tsserver +21 -0
  17. package/packages/core/node_modules/.bin/tsx +21 -0
  18. package/packages/core/node_modules/.bin/vitest +21 -0
  19. package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  20. package/packages/core/package.json +44 -0
  21. package/packages/core/src/common/array.test.ts +19 -0
  22. package/packages/core/src/common/array.ts +15 -0
  23. package/packages/core/src/common/index.ts +5 -0
  24. package/packages/core/src/common/is.ts +23 -0
  25. package/packages/core/src/common/object.ts +35 -0
  26. package/packages/core/src/common/phantom.ts +1 -0
  27. package/packages/core/src/common/result.ts +43 -0
  28. package/packages/core/src/common/string.ts +28 -0
  29. package/packages/core/src/common/types.ts +34 -0
  30. package/packages/core/src/index.ts +1 -0
  31. package/packages/core/src/shape/annotate.ts +139 -0
  32. package/packages/core/src/shape/annotation.ts +47 -0
  33. package/packages/core/src/shape/base.ts +71 -0
  34. package/packages/core/src/shape/builder.test.ts +728 -0
  35. package/packages/core/src/shape/builder.ts +475 -0
  36. package/packages/core/src/shape/error.ts +4 -0
  37. package/packages/core/src/shape/index.ts +3 -0
  38. package/packages/core/src/shape/number.ts +118 -0
  39. package/packages/core/src/shape/shape.test.ts +792 -0
  40. package/packages/core/src/shape/shape.ts +377 -0
  41. package/packages/core/src/shape/tags.ts +14 -0
  42. package/packages/core/src/shape/transforms/index.ts +3 -0
  43. package/packages/core/src/shape/transforms/json-schema/index.ts +2 -0
  44. package/packages/core/src/shape/transforms/json-schema/transform.test.ts +850 -0
  45. package/packages/core/src/shape/transforms/json-schema/transform.ts +882 -0
  46. package/packages/core/src/shape/transforms/json-schema/types.ts +132 -0
  47. package/packages/core/src/shape/transforms/sql/dialects/dialect.ts +89 -0
  48. package/packages/core/src/shape/transforms/sql/dialects/index.ts +14 -0
  49. package/packages/core/src/shape/transforms/sql/dialects/postgres.ts +392 -0
  50. package/packages/core/src/shape/transforms/sql/dialects/sqlite.ts +333 -0
  51. package/packages/core/src/shape/transforms/sql/from-sql.test.ts +704 -0
  52. package/packages/core/src/shape/transforms/sql/from-sql.ts +210 -0
  53. package/packages/core/src/shape/transforms/sql/index.ts +3 -0
  54. package/packages/core/src/shape/transforms/sql/options.ts +6 -0
  55. package/packages/core/src/shape/transforms/sql/parser/check-decoder.ts +457 -0
  56. package/packages/core/src/shape/transforms/sql/parser/create-domain.ts +105 -0
  57. package/packages/core/src/shape/transforms/sql/parser/create-table.ts +809 -0
  58. package/packages/core/src/shape/transforms/sql/parser/create-type.ts +91 -0
  59. package/packages/core/src/shape/transforms/sql/parser/cursor.ts +179 -0
  60. package/packages/core/src/shape/transforms/sql/parser/default-decoder.ts +129 -0
  61. package/packages/core/src/shape/transforms/sql/parser/lexer.ts +289 -0
  62. package/packages/core/src/shape/transforms/sql/parser/pg-types.ts +247 -0
  63. package/packages/core/src/shape/transforms/sql/parser/sqlite-types.ts +103 -0
  64. package/packages/core/src/shape/transforms/sql/parser/statements.ts +127 -0
  65. package/packages/core/src/shape/transforms/sql/parser/type-spec.ts +159 -0
  66. package/packages/core/src/shape/transforms/sql/transform.sqlite.test.ts +448 -0
  67. package/packages/core/src/shape/transforms/sql/transform.test.ts +880 -0
  68. package/packages/core/src/shape/transforms/sql/transform.ts +295 -0
  69. package/packages/core/src/shape/transforms/typescript/index.ts +1 -0
  70. package/packages/core/src/shape/transforms/typescript/transform.ts +211 -0
  71. package/packages/core/src/shape/tuple.test.ts +171 -0
  72. package/packages/core/src/shape/validate.ts +413 -0
  73. package/packages/core/tsconfig.cjs.json +11 -0
  74. package/packages/core/tsconfig.esm.json +10 -0
  75. package/packages/core/tsconfig.json +23 -0
  76. package/packages/samples/node_modules/.bin/prettier +21 -0
  77. package/packages/samples/node_modules/.bin/tsc +21 -0
  78. package/packages/samples/node_modules/.bin/tsserver +21 -0
  79. package/packages/samples/node_modules/.bin/tsx +21 -0
  80. package/packages/samples/node_modules/.bin/vitest +21 -0
  81. package/packages/samples/package.json +47 -0
  82. package/packages/samples/src/blog.ts +49 -0
  83. package/packages/samples/src/config.ts +50 -0
  84. package/packages/samples/src/ecommerce.ts +65 -0
  85. package/packages/samples/src/embeddings.ts +43 -0
  86. package/packages/samples/src/events.ts +52 -0
  87. package/packages/samples/src/geometry.ts +62 -0
  88. package/packages/samples/src/index.ts +9 -0
  89. package/packages/samples/src/relational.ts +17 -0
  90. package/packages/samples/src/tuples.ts +67 -0
  91. package/packages/samples/src/user.ts +9 -0
  92. package/packages/samples/tsconfig.cjs.json +11 -0
  93. package/packages/samples/tsconfig.esm.json +10 -0
  94. package/packages/samples/tsconfig.json +23 -0
  95. package/pnpm-workspace.yaml +3 -0
  96. package/test-data/json-schema/address.json +35 -0
  97. package/test-data/json-schema/array-of-things.json +36 -0
  98. package/test-data/json-schema/basic.json +21 -0
  99. package/test-data/json-schema/blog-post.json +29 -0
  100. package/test-data/json-schema/calendar.json +48 -0
  101. package/test-data/json-schema/complex-object-with-nested-properties.json +41 -0
  102. package/test-data/json-schema/ecommerce-complex.json +344 -0
  103. package/test-data/json-schema/ecommerce-system.json +27 -0
  104. package/test-data/json-schema/enumerated-values.json +11 -0
  105. package/test-data/json-schema/fstab-entry.json +92 -0
  106. package/test-data/json-schema/geographical-location.json +20 -0
  107. package/test-data/json-schema/health-record.json +41 -0
  108. package/test-data/json-schema/job-posting.json +33 -0
  109. package/test-data/json-schema/movie.json +35 -0
  110. package/test-data/json-schema/regular-expression-pattern.json +12 -0
  111. package/test-data/json-schema/user-profile.json +33 -0
  112. package/test-data/sql/ecommerce.sql +641 -0
@@ -0,0 +1,344 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://example.com/schemas/order.json",
4
+ "title": "Order",
5
+ "description": "Mock e-commerce order schema for unit testing. Exercises refs, allOf/oneOf/anyOf, conditionals, enums, formats, and numeric/string constraints.",
6
+ "type": "object",
7
+ "required": ["orderId", "createdAt", "status", "customer", "items", "payment", "totals"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "orderId": {
11
+ "type": "string",
12
+ "pattern": "^ORD-[0-9]{8}$",
13
+ "description": "Order identifier in the form ORD-XXXXXXXX."
14
+ },
15
+ "createdAt": { "type": "string", "format": "date-time" },
16
+ "updatedAt": { "type": "string", "format": "date-time" },
17
+ "status": { "$ref": "#/definitions/OrderStatus" },
18
+ "channel": {
19
+ "type": "string",
20
+ "enum": ["web", "mobile", "in_store", "marketplace", "phone"],
21
+ "default": "web"
22
+ },
23
+ "customer": { "$ref": "#/definitions/Customer" },
24
+ "billingAddress": { "$ref": "#/definitions/Address" },
25
+ "shippingAddress": { "$ref": "#/definitions/Address" },
26
+ "items": {
27
+ "type": "array",
28
+ "minItems": 1,
29
+ "maxItems": 100,
30
+ "uniqueItems": false,
31
+ "items": { "$ref": "#/definitions/LineItem" }
32
+ },
33
+ "shipment": { "$ref": "#/definitions/Shipment" },
34
+ "payment": { "$ref": "#/definitions/Payment" },
35
+ "discounts": {
36
+ "type": "array",
37
+ "items": { "$ref": "#/definitions/Discount" },
38
+ "default": []
39
+ },
40
+ "totals": { "$ref": "#/definitions/Totals" },
41
+ "notes": {
42
+ "type": "string",
43
+ "maxLength": 2000
44
+ },
45
+ "tags": {
46
+ "type": "array",
47
+ "items": { "type": "string", "minLength": 1, "maxLength": 32 },
48
+ "uniqueItems": true,
49
+ "maxItems": 20
50
+ },
51
+ "metadata": {
52
+ "type": "object",
53
+ "additionalProperties": {
54
+ "type": ["string", "number", "boolean", "null"]
55
+ },
56
+ "maxProperties": 50
57
+ }
58
+ },
59
+
60
+ "allOf": [
61
+ {
62
+ "comment": "Digital-only orders must not carry a shippingAddress or shipment.",
63
+ "if": {
64
+ "properties": {
65
+ "items": {
66
+ "type": "array",
67
+ "contains": {
68
+ "type": "object",
69
+ "properties": { "kind": { "const": "physical" } },
70
+ "required": ["kind"]
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "then": {
76
+ "required": ["shippingAddress", "shipment"]
77
+ },
78
+ "else": {
79
+ "not": { "required": ["shipment"] }
80
+ }
81
+ },
82
+ {
83
+ "comment": "Refunded/cancelled orders should expose a reason in metadata.",
84
+ "if": {
85
+ "properties": {
86
+ "status": { "enum": ["cancelled", "refunded"] }
87
+ },
88
+ "required": ["status"]
89
+ },
90
+ "then": {
91
+ "required": ["metadata"],
92
+ "properties": {
93
+ "metadata": {
94
+ "type": "object",
95
+ "required": ["reason"],
96
+ "properties": {
97
+ "reason": { "type": "string", "minLength": 1 }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ],
104
+
105
+ "definitions": {
106
+ "OrderStatus": {
107
+ "type": "string",
108
+ "enum": ["pending", "paid", "fulfilled", "shipped", "delivered", "cancelled", "refunded"]
109
+ },
110
+
111
+ "Currency": {
112
+ "type": "string",
113
+ "description": "ISO 4217 currency code.",
114
+ "pattern": "^[A-Z]{3}$"
115
+ },
116
+
117
+ "Money": {
118
+ "type": "object",
119
+ "required": ["amount", "currency"],
120
+ "additionalProperties": false,
121
+ "properties": {
122
+ "amount": {
123
+ "type": "number",
124
+ "minimum": 0,
125
+ "multipleOf": 0.01
126
+ },
127
+ "currency": { "$ref": "#/definitions/Currency" }
128
+ }
129
+ },
130
+
131
+ "Email": {
132
+ "type": "string",
133
+ "format": "email",
134
+ "maxLength": 254
135
+ },
136
+
137
+ "PhoneE164": {
138
+ "type": "string",
139
+ "pattern": "^\\+[1-9]\\d{1,14}$",
140
+ "description": "E.164 phone number."
141
+ },
142
+
143
+ "Customer": {
144
+ "type": "object",
145
+ "required": ["id", "email"],
146
+ "additionalProperties": false,
147
+ "properties": {
148
+ "id": {
149
+ "type": "string",
150
+ "format": "uuid"
151
+ },
152
+ "email": { "$ref": "#/definitions/Email" },
153
+ "firstName": { "type": "string", "minLength": 1, "maxLength": 80 },
154
+ "lastName": { "type": "string", "minLength": 1, "maxLength": 80 },
155
+ "phone": { "$ref": "#/definitions/PhoneE164" },
156
+ "loyaltyTier": {
157
+ "type": "string",
158
+ "enum": ["none", "silver", "gold", "platinum"],
159
+ "default": "none"
160
+ },
161
+ "marketingOptIn": { "type": "boolean", "default": false }
162
+ }
163
+ },
164
+
165
+ "Address": {
166
+ "type": "object",
167
+ "required": ["line1", "city", "country", "postalCode"],
168
+ "additionalProperties": false,
169
+ "properties": {
170
+ "line1": { "type": "string", "minLength": 1, "maxLength": 120 },
171
+ "line2": { "type": "string", "maxLength": 120 },
172
+ "city": { "type": "string", "minLength": 1, "maxLength": 80 },
173
+ "region": { "type": "string", "maxLength": 80 },
174
+ "postalCode": { "type": "string", "minLength": 2, "maxLength": 16 },
175
+ "country": {
176
+ "type": "string",
177
+ "pattern": "^[A-Z]{2}$",
178
+ "description": "ISO 3166-1 alpha-2 country code."
179
+ }
180
+ }
181
+ },
182
+
183
+ "LineItem": {
184
+ "type": "object",
185
+ "required": ["sku", "kind", "name", "quantity", "unitPrice"],
186
+ "additionalProperties": false,
187
+ "properties": {
188
+ "sku": {
189
+ "type": "string",
190
+ "pattern": "^[A-Z0-9-]{4,32}$"
191
+ },
192
+ "kind": {
193
+ "type": "string",
194
+ "enum": ["physical", "digital", "service"]
195
+ },
196
+ "name": { "type": "string", "minLength": 1, "maxLength": 200 },
197
+ "quantity": {
198
+ "type": "integer",
199
+ "minimum": 1,
200
+ "maximum": 1000
201
+ },
202
+ "unitPrice": { "$ref": "#/definitions/Money" },
203
+ "weightKg": {
204
+ "type": "number",
205
+ "exclusiveMinimum": 0,
206
+ "maximum": 1000
207
+ },
208
+ "attributes": {
209
+ "type": "object",
210
+ "additionalProperties": { "type": "string" },
211
+ "maxProperties": 20
212
+ }
213
+ },
214
+ "allOf": [
215
+ {
216
+ "comment": "Physical items require a positive weight.",
217
+ "if": { "properties": { "kind": { "const": "physical" } } },
218
+ "then": { "required": ["weightKg"] }
219
+ }
220
+ ]
221
+ },
222
+
223
+ "Shipment": {
224
+ "type": "object",
225
+ "required": ["carrier", "service"],
226
+ "additionalProperties": false,
227
+ "properties": {
228
+ "carrier": {
229
+ "type": "string",
230
+ "enum": ["ups", "fedex", "dhl", "usps", "postnord", "other"]
231
+ },
232
+ "service": { "type": "string", "minLength": 1, "maxLength": 80 },
233
+ "trackingNumber": { "type": "string", "minLength": 4, "maxLength": 64 },
234
+ "estimatedDelivery": { "type": "string", "format": "date" },
235
+ "shippedAt": { "type": "string", "format": "date-time" }
236
+ }
237
+ },
238
+
239
+ "Payment": {
240
+ "type": "object",
241
+ "required": ["method", "status", "amount"],
242
+ "additionalProperties": false,
243
+ "properties": {
244
+ "method": {
245
+ "type": "string",
246
+ "enum": ["card", "paypal", "bank_transfer", "invoice", "gift_card"]
247
+ },
248
+ "status": {
249
+ "type": "string",
250
+ "enum": ["authorized", "captured", "failed", "refunded", "pending"]
251
+ },
252
+ "amount": { "$ref": "#/definitions/Money" },
253
+ "details": {
254
+ "oneOf": [
255
+ { "$ref": "#/definitions/CardDetails" },
256
+ { "$ref": "#/definitions/PayPalDetails" },
257
+ { "$ref": "#/definitions/BankTransferDetails" }
258
+ ]
259
+ }
260
+ }
261
+ },
262
+
263
+ "CardDetails": {
264
+ "type": "object",
265
+ "required": ["type", "brand", "last4", "expMonth", "expYear"],
266
+ "additionalProperties": false,
267
+ "properties": {
268
+ "type": { "const": "card" },
269
+ "brand": {
270
+ "type": "string",
271
+ "enum": ["visa", "mastercard", "amex", "discover", "other"]
272
+ },
273
+ "last4": {
274
+ "type": "string",
275
+ "pattern": "^[0-9]{4}$"
276
+ },
277
+ "expMonth": { "type": "integer", "minimum": 1, "maximum": 12 },
278
+ "expYear": { "type": "integer", "minimum": 2020, "maximum": 2100 }
279
+ }
280
+ },
281
+
282
+ "PayPalDetails": {
283
+ "type": "object",
284
+ "required": ["type", "payerEmail"],
285
+ "additionalProperties": false,
286
+ "properties": {
287
+ "type": { "const": "paypal" },
288
+ "payerEmail": { "$ref": "#/definitions/Email" }
289
+ }
290
+ },
291
+
292
+ "BankTransferDetails": {
293
+ "type": "object",
294
+ "required": ["type", "iban"],
295
+ "additionalProperties": false,
296
+ "properties": {
297
+ "type": { "const": "bank_transfer" },
298
+ "iban": {
299
+ "type": "string",
300
+ "pattern": "^[A-Z]{2}[0-9]{2}[A-Z0-9]{10,30}$"
301
+ },
302
+ "bic": {
303
+ "type": "string",
304
+ "pattern": "^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$"
305
+ }
306
+ }
307
+ },
308
+
309
+ "Discount": {
310
+ "type": "object",
311
+ "required": ["code", "type", "value"],
312
+ "additionalProperties": false,
313
+ "properties": {
314
+ "code": { "type": "string", "minLength": 2, "maxLength": 40 },
315
+ "type": { "type": "string", "enum": ["percentage", "fixed", "free_shipping"] },
316
+ "value": { "type": "number", "minimum": 0 },
317
+ "appliedTo": {
318
+ "type": "string",
319
+ "enum": ["order", "item", "shipping"],
320
+ "default": "order"
321
+ }
322
+ },
323
+ "allOf": [
324
+ {
325
+ "if": { "properties": { "type": { "const": "percentage" } } },
326
+ "then": { "properties": { "value": { "maximum": 100 } } }
327
+ }
328
+ ]
329
+ },
330
+
331
+ "Totals": {
332
+ "type": "object",
333
+ "required": ["subtotal", "tax", "shipping", "grandTotal"],
334
+ "additionalProperties": false,
335
+ "properties": {
336
+ "subtotal": { "$ref": "#/definitions/Money" },
337
+ "tax": { "$ref": "#/definitions/Money" },
338
+ "shipping": { "$ref": "#/definitions/Money" },
339
+ "discountTotal": { "$ref": "#/definitions/Money" },
340
+ "grandTotal": { "$ref": "#/definitions/Money" }
341
+ }
342
+ }
343
+ }
344
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$id": "https://example.com/ecommerce.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "ecommerce-system",
5
+ "$defs": {
6
+ "product": {
7
+ "$anchor": "ProductSchema",
8
+ "type": "object",
9
+ "properties": {
10
+ "name": { "type": "string" },
11
+ "price": { "type": "number", "minimum": 0 }
12
+ }
13
+ },
14
+ "order": {
15
+ "$anchor": "OrderSchema",
16
+ "type": "object",
17
+ "properties": {
18
+ "orderId": { "type": "string" },
19
+ "items": {
20
+ "type": "array",
21
+ "items": { "$ref": "#ProductSchema" }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
27
+
@@ -0,0 +1,11 @@
1
+ {
2
+ "$id": "https://example.com/enumerated-values.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "Enumerated Values",
5
+ "type": "object",
6
+ "properties": {
7
+ "data": {
8
+ "enum": [42, true, "hello", null, [1, 2, 3]]
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "$id": "https://example.com/entry-schema",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "fstab",
5
+ "description": "JSON Schema for an fstab entry",
6
+ "type": "object",
7
+ "required": [ "storage" ],
8
+ "properties": {
9
+ "storage": {
10
+ "type": "object",
11
+ "oneOf": [
12
+ { "$ref": "#/$defs/diskDevice" },
13
+ { "$ref": "#/$defs/diskUUID" },
14
+ { "$ref": "#/$defs/nfs" },
15
+ { "$ref": "#/$defs/tmpfs" }
16
+ ]
17
+ },
18
+ "fstype": {
19
+ "enum": [ "ext3", "ext4", "btrfs" ]
20
+ },
21
+ "options": {
22
+ "type": "array",
23
+ "minItems": 1,
24
+ "items": {
25
+ "type": "string"
26
+ },
27
+ "uniqueItems": true
28
+ },
29
+ "readonly": {
30
+ "type": "boolean"
31
+ }
32
+ },
33
+ "$defs": {
34
+ "diskDevice": {
35
+ "properties": {
36
+ "type": {
37
+ "enum": [ "disk" ]
38
+ },
39
+ "device": {
40
+ "type": "string",
41
+ "pattern": "^/dev/[^/]+(/[^/]+)*$"
42
+ }
43
+ },
44
+ "required": [ "type", "device" ],
45
+ "additionalProperties": false
46
+ },
47
+ "diskUUID": {
48
+ "properties": {
49
+ "type": {
50
+ "enum": [ "disk" ]
51
+ },
52
+ "label": {
53
+ "type": "string",
54
+ "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
55
+ }
56
+ },
57
+ "required": [ "type", "label" ],
58
+ "additionalProperties": false
59
+ },
60
+ "nfs": {
61
+ "properties": {
62
+ "type": { "enum": [ "nfs" ] },
63
+ "remotePath": {
64
+ "type": "string",
65
+ "pattern": "^(/[^/]+)+$"
66
+ },
67
+ "server": {
68
+ "type": "string",
69
+ "oneOf": [
70
+ { "format": "hostname" },
71
+ { "format": "ipv4" },
72
+ { "format": "ipv6" }
73
+ ]
74
+ }
75
+ },
76
+ "required": [ "type", "server", "remotePath" ],
77
+ "additionalProperties": false
78
+ },
79
+ "tmpfs": {
80
+ "properties": {
81
+ "type": { "enum": [ "tmpfs" ] },
82
+ "sizeInMB": {
83
+ "type": "integer",
84
+ "minimum": 16,
85
+ "maximum": 512
86
+ }
87
+ },
88
+ "required": [ "type", "sizeInMB" ],
89
+ "additionalProperties": false
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$id": "https://example.com/geographical-location.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "geographical-location",
5
+ "description": "A geographical coordinate.",
6
+ "required": [ "latitude", "longitude" ],
7
+ "type": "object",
8
+ "properties": {
9
+ "latitude": {
10
+ "type": "number",
11
+ "minimum": -90,
12
+ "maximum": 90
13
+ },
14
+ "longitude": {
15
+ "type": "number",
16
+ "minimum": -180,
17
+ "maximum": 180
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$id": "https://example.com/health-record.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "health-record",
5
+ "description": "Schema for representing a health record",
6
+ "type": "object",
7
+ "required": ["patientName", "dateOfBirth", "bloodType"],
8
+ "properties": {
9
+ "patientName": {
10
+ "type": "string"
11
+ },
12
+ "dateOfBirth": {
13
+ "type": "string",
14
+ "format": "date"
15
+ },
16
+ "bloodType": {
17
+ "type": "string"
18
+ },
19
+ "allergies": {
20
+ "type": "array",
21
+ "items": {
22
+ "type": "string"
23
+ }
24
+ },
25
+ "conditions": {
26
+ "type": "array",
27
+ "items": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "medications": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "string"
35
+ }
36
+ },
37
+ "emergencyContact": {
38
+ "$ref": "https://example.com/user-profile.schema.json"
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$id": "https://example.com/job-posting.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "job-posting",
5
+ "description": "A representation of a job posting",
6
+ "type": "object",
7
+ "required": ["title", "company", "location", "description"],
8
+ "properties": {
9
+ "title": {
10
+ "type": "string"
11
+ },
12
+ "company": {
13
+ "type": "string"
14
+ },
15
+ "location": {
16
+ "type": "string"
17
+ },
18
+ "description": {
19
+ "type": "string"
20
+ },
21
+ "employmentType": {
22
+ "type": "string"
23
+ },
24
+ "salary": {
25
+ "type": "number",
26
+ "minimum": 0
27
+ },
28
+ "applicationDeadline": {
29
+ "type": "string",
30
+ "format": "date"
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$id": "https://example.com/movie.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "movie",
5
+ "description": "A representation of a movie",
6
+ "type": "object",
7
+ "required": ["title", "director", "releaseDate"],
8
+ "properties": {
9
+ "title": {
10
+ "type": "string"
11
+ },
12
+ "director": {
13
+ "type": "string"
14
+ },
15
+ "releaseDate": {
16
+ "type": "string",
17
+ "format": "date"
18
+ },
19
+ "genre": {
20
+ "type": "string",
21
+ "enum": ["Action", "Comedy", "Drama", "Science Fiction"]
22
+ },
23
+ "duration": {
24
+ "type": "string"
25
+ },
26
+ "cast": {
27
+ "type": "array",
28
+ "items": {
29
+ "type": "string"
30
+ },
31
+ "additionalItems": false
32
+ }
33
+ }
34
+ }
35
+
@@ -0,0 +1,12 @@
1
+ {
2
+ "$id": "https://example.com/regex-pattern.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "Regular Expression Pattern",
5
+ "type": "object",
6
+ "properties": {
7
+ "code": {
8
+ "type": "string",
9
+ "pattern": "^[A-Z]{3}-\\d{3}$"
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$id": "https://example.com/user-profile.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "user-profile",
5
+ "description": "A representation of a user profile",
6
+ "type": "object",
7
+ "required": ["username", "email"],
8
+ "properties": {
9
+ "username": {
10
+ "type": "string"
11
+ },
12
+ "email": {
13
+ "type": "string",
14
+ "format": "email"
15
+ },
16
+ "fullName": {
17
+ "type": "string"
18
+ },
19
+ "age": {
20
+ "type": "integer",
21
+ "minimum": 0
22
+ },
23
+ "location": {
24
+ "type": "string"
25
+ },
26
+ "interests": {
27
+ "type": "array",
28
+ "items": {
29
+ "type": "string"
30
+ }
31
+ }
32
+ }
33
+ }