change in Initialse function to read each folder and add test cases
This commit is contained in:
@@ -1,208 +0,0 @@
|
||||
{
|
||||
"$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": {
|
||||
"location": {
|
||||
"type": "value",
|
||||
"properties": {
|
||||
"city": {
|
||||
"type": "value",
|
||||
"properties": {
|
||||
},
|
||||
"required": ["code"]
|
||||
},
|
||||
"country": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
},
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
14
plugins/testData/invalid_structure/v2.0.0/schema.json
Normal file
14
plugins/testData/invalid_structure/v2.0.0/schema.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Example Schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["name", "age"]
|
||||
}
|
||||
63
plugins/testData/payloads/search_extraField.json
Normal file
63
plugins/testData/payloads/search_extraField.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"context": {
|
||||
"action": "search",
|
||||
"bap_id": "bap.example.com",
|
||||
"bap_uri": "https://example-bap.com/prod/trv10",
|
||||
"domain": "example-domain",
|
||||
"location": {
|
||||
"city": {
|
||||
"code": "PUN"
|
||||
},
|
||||
"country": {
|
||||
"code": "IND"
|
||||
}
|
||||
},
|
||||
"message_id": "123e4567-e89b-12d3-a456-426614174000",
|
||||
"timestamp": "2025-03-06T12:00:00Z",
|
||||
"transaction_id": "123e4567-e89b-12d3-a456-426614174001",
|
||||
"ttl": "PT30M",
|
||||
"version": "1.0.0",
|
||||
"extra_field": "unexpected_value"
|
||||
},
|
||||
"message": {
|
||||
"intent": {
|
||||
"fulfillment": {
|
||||
"stops": [
|
||||
{
|
||||
"location": {
|
||||
"gps": "19.0760,72.8777",
|
||||
"created_at": "unexpected_value"
|
||||
},
|
||||
"type": "START"
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"gps": "18.5204,73.8567"
|
||||
},
|
||||
"type": "END"
|
||||
}
|
||||
]
|
||||
},
|
||||
"payment": {
|
||||
"collected_by": "BPP",
|
||||
"tags": [
|
||||
{
|
||||
"descriptor": {
|
||||
"code": "some-code"
|
||||
},
|
||||
"display": true,
|
||||
"list": [
|
||||
{
|
||||
"descriptor": {
|
||||
"code": "list-code"
|
||||
},
|
||||
"value": "list-value"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
plugins/testData/payloads/search_missingField.json
Normal file
65
plugins/testData/payloads/search_missingField.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"context": {
|
||||
"action": "search",
|
||||
"bap_id": "example-bap.com",
|
||||
"bap_uri": "https://example-bap.com/prod/trv10",
|
||||
"domain": "ONDC:TRV10",
|
||||
"location": {
|
||||
"city": {
|
||||
"code": "std:080"
|
||||
},
|
||||
"country": {
|
||||
"code": "IND"
|
||||
}
|
||||
},
|
||||
"message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c",
|
||||
"timestamp": "2023-12-09T13:39:56.645Z",
|
||||
"transaction_id": "870782be-6757-43f1-945c-8eeaf9536259",
|
||||
"ttl": "PT30S",
|
||||
"version": "2.0.0"
|
||||
},
|
||||
"message": {
|
||||
"intent": {
|
||||
"payment": {
|
||||
"collected_by": "BPP",
|
||||
"tags": [
|
||||
{
|
||||
"descriptor": {
|
||||
"code": "BUYER_FINDER_FEES"
|
||||
},
|
||||
"display": false,
|
||||
"list": [
|
||||
{
|
||||
"descriptor": {
|
||||
"code": "BUYER_FINDER_FEES_PERCENTAGE"
|
||||
},
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"descriptor": {
|
||||
"code": "SETTLEMENT_TERMS"
|
||||
},
|
||||
"display": false,
|
||||
"list": [
|
||||
{
|
||||
"descriptor": {
|
||||
"code": "DELAY_INTEREST"
|
||||
},
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"descriptor": {
|
||||
"code": "STATIC_TERMS"
|
||||
},
|
||||
"value": "https://example-test-bap.com/static-terms.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
14
plugins/testData/valid_schemas/schema.json
Normal file
14
plugins/testData/valid_schemas/schema.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Example Schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["name", "age"]
|
||||
}
|
||||
Reference in New Issue
Block a user