|
11 | 11 | "result": { |
12 | 12 | "type": "object", |
13 | 13 | "additionalProperties": false, |
14 | | - "required": ["shipment_id","order_id","status"], |
| 14 | + "required": ["shipment_id", "order_id", "status"], |
15 | 15 | "properties": { |
16 | 16 | "shipment_id": { "type": "string", "minLength": 1, "maxLength": 128 }, |
17 | 17 | "shipment_group_id": { "type": "string", "minLength": 1, "maxLength": 128 }, |
18 | 18 | "order_id": { "type": "string", "minLength": 1, "maxLength": 128 }, |
19 | | - "status": { "type": "string", "enum": ["label_created","in_transit","delivered","failed","returned"] }, |
| 19 | + "status": { "type": "string", "enum": ["label_created", "in_transit", "delivered", "failed", "returned"] }, |
20 | 20 | "carrier": { "type": "string", "maxLength": 64 }, |
21 | 21 | "tracking_number": { "type": "string", "maxLength": 128, "pattern": "^[A-Z0-9][-A-Z0-9]{5,}$" }, |
22 | 22 | "tracking_url": { "type": "string", "format": "uri", "maxLength": 512 }, |
|
33 | 33 | }, |
34 | 34 | "required": ["result"], |
35 | 35 | "allOf": [ |
36 | | - { "if": { "properties": { "status": { "const": "success" } }, "required": ["status"] }, "then": { "required": ["result"] } }, |
37 | | - { "if": { "properties": { "status": { "const": "error" } }, "required": ["status"] }, "then": { "required": ["error"], "properties": { "result": false } } }, |
38 | | - { |
39 | | - "if": { "properties": { "result": { "properties": { "status": { "enum": ["label_created","in_transit","delivered"] } } } } }, |
40 | | - "then": { "properties": { "result": { "required": ["carrier","tracking_number"] } } } |
41 | | - } |
| 36 | + { "if": { "properties": { "status": { "const": "success" } }, "required": ["status"] }, |
| 37 | + "then": { "properties": { "result": {} }, "required": ["result"] } }, |
| 38 | + { "if": { "properties": { "status": { "const": "error" } }, "required": ["status"] }, |
| 39 | + "then": { "properties": { "error": {}, "result": false }, "required": ["error"] } }, |
| 40 | + { "if": { "properties": { "result": { "properties": { "status": { "enum": ["label_created", "in_transit", "delivered"] } } } } }, |
| 41 | + "then": { "properties": { "result": { "properties": { "carrier": {}, "tracking_number": {} }, "required": ["carrier", "tracking_number"] } } } } |
42 | 42 | ] |
43 | 43 | } |
44 | 44 | ] |
|
0 commit comments