192 lines
3.8 KiB
JSON
192 lines
3.8 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://arr.local/contracts/booking-row-parse-result.schema.json",
|
|
"title": "ARR Booking Source Row Parse Result",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"result_schema_version",
|
|
"status",
|
|
"source_row",
|
|
"processor_version",
|
|
"rule_set_sha256",
|
|
"group_code_raw",
|
|
"group_code_key",
|
|
"type_of_room_raw",
|
|
"no_of_rooms",
|
|
"room_items",
|
|
"warnings",
|
|
"errors"
|
|
],
|
|
"properties": {
|
|
"result_schema_version": {
|
|
"const": "1.0"
|
|
},
|
|
"status": {
|
|
"enum": ["accepted", "needs_review", "failed"]
|
|
},
|
|
"source_row": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["worksheet", "row_no", "sha256"],
|
|
"properties": {
|
|
"worksheet": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"row_no": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"sha256": {
|
|
"$ref": "#/$defs/sha256"
|
|
}
|
|
}
|
|
},
|
|
"processor_version": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"rule_set_sha256": {
|
|
"$ref": "#/$defs/sha256"
|
|
},
|
|
"group_code_raw": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"group_code_key": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"type_of_room_raw": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"no_of_rooms": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"room_items": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/roomItem"
|
|
}
|
|
},
|
|
"warnings": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/message"
|
|
}
|
|
},
|
|
"errors": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/message"
|
|
}
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"status": {
|
|
"const": "accepted"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"room_items": {
|
|
"minItems": 1
|
|
},
|
|
"errors": {
|
|
"maxItems": 0
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"status": {
|
|
"const": "failed"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"properties": {
|
|
"errors": {
|
|
"minItems": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"$defs": {
|
|
"sha256": {
|
|
"type": "string",
|
|
"pattern": "^[0-9a-f]{64}$"
|
|
},
|
|
"message": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["code", "message"],
|
|
"properties": {
|
|
"code": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"roomItem": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"item_no",
|
|
"room_type_raw",
|
|
"room_type_code",
|
|
"quantity",
|
|
"unit_price",
|
|
"currency_code",
|
|
"price_token_raw",
|
|
"source_fragment"
|
|
],
|
|
"properties": {
|
|
"item_no": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"room_type_raw": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"room_type_code": {
|
|
"type": ["string", "null"],
|
|
"minLength": 1
|
|
},
|
|
"quantity": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"unit_price": {
|
|
"type": ["number", "null"],
|
|
"minimum": 0
|
|
},
|
|
"currency_code": {
|
|
"type": ["string", "null"],
|
|
"pattern": "^[A-Z]{3}$"
|
|
},
|
|
"price_token_raw": {
|
|
"type": ["string", "null"]
|
|
},
|
|
"source_fragment": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|