Files
onix/plugins/schema_valid/ondc_trv10_2.0.0/select.json
AshwiniK-protean 113aadbb0a add new schemas
2025-02-27 10:23:49 +05:30

202 lines
7.5 KiB
JSON

{
"$id": "https://example.com/ondc/trv10/2.0.0",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"select": {
"$id": "select#",
"type": "object",
"properties": {
"context": {
"type": "object",
"properties": {
"domain": {
"type": "string"
},
"location": {
"type": "object",
"properties": {
"city": {
"type": "object",
"properties": {
"code": {
"type": "string"
}
},
"required": ["code"]
},
"country": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": ["IND"]
}
},
"required": ["code"]
}
}
}
},
"required": ["domain", "location", "action", "bap_id", "bap_uri", "transaction_id", "message_id", "timestamp", "ttl"]
},
"message": {
"type": "object",
"properties": {
"intent": {
"type": "object",
"properties": {
"fulfillment": {
"type": "object",
"properties": {
"stops": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "object",
"properties": {
"gps": {
"type": "string"
}
},
"required": ["gps"]
},
"type": {
"type": "string",
"enum": ["START", "END"]
}
},
"required": ["location", "type"]
},
"minItems": 2,
"maxItems": 2
}
},
"required": ["stops"]
},
"payment": {
"type": "object",
"properties": {
"collected_by": {
"type": "string",
"enum": ["BPP", "BAP"]
},
"tags": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": ["SETTLEMENT_TERMS", "BUYER_FINDER_FEES"]
}
},
"required": ["code"]
}
},
"allOf": [
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "SETTLEMENT_TERMS"
}
},
"required": ["code"]
}
}
},
"then": {
"properties": {
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": ["SETTLEMENT_BASIS", "SETTLEMENT_WINDOW", "STATIC_TERMS", "SETTLEMENT_TYPE", "DELAY_INTEREST"]
}
},
"required": ["code"]
},
"value": {
"type": "string"
}
},
"required": ["descriptor", "value"]
}
}
}
}
},
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "BUYER_FINDER_FEES"
}
},
"required": ["code"]
}
}
},
"then": {
"properties": {
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"enum": ["BUYER_FINDER_FEES_PERCENTAGE"]
}
},
"required": ["code"]
},
"value": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
},
"required": ["descriptor", "value"]
}
}
}
}
}
],
"required": ["descriptor"]
}
}
},
"required": ["collected_by", "tags"]
}
},
"required": ["fulfillment", "payment"]
}
},
"required": ["intent"]
}
}
}
}
}