update schemas and create a validateHandler function

This commit is contained in:
AshwiniK-protean
2025-03-02 18:44:16 +05:30
parent 4b940d9e51
commit 4559ac3e5f
28 changed files with 3053 additions and 3552 deletions

View File

@@ -7,604 +7,16 @@
"$ref": "../../core/v1.1.0/on_select.json#"
},
{
"$ref": "./init.json#/allOf/2"
"$ref": "./init.json#/allOf/1"
},
{
"properties": {
"message": {
"type": "object",
"properties": {
"order": {
"type": "object",
"properties": {
"items": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"descriptor": {
"type": "object",
"properties": {
"name": { "type": "string" },
"code": { "type": "string", "enum": ["RIDE"] }
},
"required": ["code"]
},
"price": {
"type": "object",
"properties": { "value": { "type": "string" } },
"required": ["value"]
},
"fulfillment_ids": { "minItems": 1 },
"location_ids": { "minItems": 1 }
},
"required": ["id", "price", "descriptor"]
}
}
},
"required": ["items"]
}
}
}
}
"$ref": "./on_init.json#/allOf/2"
},
{
"allOf": [
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"items": {
"items": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": { "const": "FARE_POLICY" }
}
}
}
},
"then": {
"properties": {
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"properties": {
"code": {
"type": "string",
"enum": [
"MIN_FARE",
"MIN_FARE_DISTANCE_KM",
"PER_KM_CHARGE",
"PICKUP_CHARGE",
"WAITING_CHARGE_PER_MIN",
"NIGHT_CHARGE_MULTIPLIER",
"NIGHT_SHIFT_START_TIME",
"NIGHT_SHIFT_END_TIME",
"EXTERNAL_REF"
]
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"items": {
"items": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": { "const": "FARE_POLICY" }
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "MIN_FARE" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^[0-9]+(\\.[0-9]+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "MIN_FARE_DISTANCE_KM" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^[0-9]+(\\.[0-9]+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "PER_KM_CHARGE" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^[0-9]+(\\.[0-9]+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "PICKUP_CHARGE" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^[0-9]+(\\.[0-9]+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "WAITING_CHARGE_PER_MIN" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^[0-9]+(\\.[0-9]+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "NIGHT_CHARGE_MULTIPLIER" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^[0-9]+(\\.[0-9]+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "NIGHT_SHIFT_START_TIME" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$"
}
},
"required": ["descriptor", "value"]
}
}
]
}
}
}
}
}
}
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"items": {
"items": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": { "const": "FARE_POLICY" }
}
}
}
},
"then": {
"properties": {
"list": {
"type": "array",
"items": {
"allOf": [
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"enum": [
"MIN_FARE",
"MIN_FARE_DISTANCE_KM",
"PER_KM_CHARGE",
"PICKUP_CHARGE",
"WAITING_CHARGE_PER_MIN",
"NIGHT_CHARGE_MULTIPLIER"
]
}
}
}
}
},
"then": {
"properties": {
"value": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"enum": [
"NIGHT_SHIFT_START_TIME",
"NIGHT_SHIFT_END_TIME"
]
}
}
}
}
},
"then": {
"properties": {
"value": {
"type": "string",
"pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$"
}
},
"required": ["descriptor", "value"]
}
},
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": { "const": "EXTERNAL_REF" }
}
}
}
},
"then": {
"properties": {
"value": {
"type": "string",
"pattern": "^https?://[^\\s/$.?#].[^\\s]*$"
}
},
"required": ["descriptor", "value"]
}
}
]
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
]
"$ref": "./confirm.json#/allOf/5"
},
{
"allOf": [
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"items": {
"items": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": { "const": "INFO" }
}
}
}
},
"then": {
"properties": {
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"properties": {
"code": {
"type": "string",
"enum": [
"DISTANCE_TO_NEAREST_DRIVER_METER",
"ETA_TO_NEAREST_DRIVER_MIN"
]
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"items": {
"items": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": { "const": "INFO" }
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "ETA_TO_NEAREST_DRIVER_MIN" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d+)?$"
}
},
"required": ["descriptor", "value"]
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "const": "DISTANCE_TO_NEAREST_DRIVER_METER" }
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d+)?$"
}
},
"required": ["descriptor", "value"]
}
}
]
}
}
}
}
}
}
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"items": {
"type": "array",
"items": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": { "const": "INFO" }
}
}
}
},
"then": {
"properties": {
"list": {
"type": "array",
"items": {
"allOf": [
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"enum": [
"DISTANCE_TO_NEAREST_DRIVER_METER",
"ETA_TO_NEAREST_DRIVER_MIN"
]
}
}
}
}
},
"then": {
"properties": {
"value": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
},
"required": ["descriptor", "value"]
}
}
]
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
]
"$ref": "./on_init.json#/allOf/5"
},
{
"allOf": [
@@ -784,6 +196,9 @@
}
]
},
{
"$ref": "./on_init.json#/allOf/7"
},
{
"properties": {
"message": {
@@ -807,6 +222,9 @@
}
}
}
}
},
{
"$ref": "./on_init.json#/allOf/8"
}
]
}