Moved test schemas to testData folder, removed schemas folder from plugin, and deleted schema_die path from config

This commit is contained in:
AshwiniK-protean
2025-03-05 15:54:44 +05:30
parent 02ebd9fd38
commit 19c8b35bdd
61 changed files with 139 additions and 7038 deletions

View File

@@ -2,5 +2,5 @@ plugins:
validation_plugin: validation_plugin:
id: tekuriValidator id: tekuriValidator
config: config:
schema_dir: plugins/schemas/ schema_dir:
plugin_path: plugins/implementations/ plugin_path: plugins/implementations/

View File

@@ -4,7 +4,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"os" "os"
"testing" "testing"
@@ -21,7 +20,7 @@ type Message struct{}
func TestInitializeValidDirectory(t *testing.T) { func TestInitializeValidDirectory(t *testing.T) {
provider := &TekuriValidatorProvider{} provider := &TekuriValidatorProvider{}
schemaDir := "../schemas/" schemaDir := "../testData/schema_valid/"
_, err := provider.Initialize(schemaDir) _, err := provider.Initialize(schemaDir)
if err != nil { if err != nil {
t.Fatalf("expected no error, got %v", err) t.Fatalf("expected no error, got %v", err)
@@ -30,7 +29,7 @@ func TestInitializeValidDirectory(t *testing.T) {
func TestInitializeInValidDirectory(t *testing.T) { func TestInitializeInValidDirectory(t *testing.T) {
provider := &TekuriValidatorProvider{} provider := &TekuriValidatorProvider{}
schemaDir := "../schema/ondc_trv10_2.0.0/" schemaDir := "../testData/schema/ondc_trv10/"
_, err := provider.Initialize(schemaDir) _, err := provider.Initialize(schemaDir)
if err != nil { if err != nil {
t.Fatalf("failed to read schema directory: %v", err) t.Fatalf("failed to read schema directory: %v", err)
@@ -38,7 +37,7 @@ func TestInitializeInValidDirectory(t *testing.T) {
} }
func TestInvalidCompileFile(t *testing.T) { func TestInvalidCompileFile(t *testing.T) {
schemaDir := "../invalid_schemas/" schemaDir := "../testData/invalid_compile_schema/"
if _, err := os.Stat(schemaDir); os.IsNotExist(err) { if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
t.Fatalf("Schema directory does not exist: %v", schemaDir) t.Fatalf("Schema directory does not exist: %v", schemaDir)
} }
@@ -54,7 +53,7 @@ func TestInvalidCompileFile(t *testing.T) {
} }
func TestInvalidCompileSchema(t *testing.T) { func TestInvalidCompileSchema(t *testing.T) {
schemaDir := "../invalid_schemas/invalid_compile_schema/" schemaDir := "../testData/invalid_schemas/"
if _, err := os.Stat(schemaDir); os.IsNotExist(err) { if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
t.Fatalf("Schema directory does not exist: %v", schemaDir) t.Fatalf("Schema directory does not exist: %v", schemaDir)
} }
@@ -68,7 +67,7 @@ func TestInvalidCompileSchema(t *testing.T) {
} }
func TestValidateData(t *testing.T) { func TestValidateData(t *testing.T) {
schemaDir := "../schemas/" schemaDir := "../testData/schema_valid/"
if _, err := os.Stat(schemaDir); os.IsNotExist(err) { if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
t.Fatalf("Schema directory does not exist: %v", schemaDir) t.Fatalf("Schema directory does not exist: %v", schemaDir)
} }
@@ -89,8 +88,8 @@ func TestValidateData(t *testing.T) {
t.Fatalf("No validators found in the map") t.Fatalf("No validators found in the map")
} }
payloadFilePath := "../testData/payload.json" payloadFilePath := "../testData/cancel.json"
payloadData, err := ioutil.ReadFile(payloadFilePath) payloadData, err := os.ReadFile(payloadFilePath)
if err != nil { if err != nil {
t.Fatalf("Failed to read payload data: %v", err) t.Fatalf("Failed to read payload data: %v", err)
} }
@@ -108,7 +107,7 @@ func TestValidateData(t *testing.T) {
} }
func TestInValidateData(t *testing.T) { func TestInValidateData(t *testing.T) {
schemaDir := "../schema_valid/ondc_trv10_2.0.0/" schemaDir := "../testData/schema_valid/"
if _, err := os.Stat(schemaDir); os.IsNotExist(err) { if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
t.Fatalf("Schema directory does not exist: %v", schemaDir) t.Fatalf("Schema directory does not exist: %v", schemaDir)
@@ -138,7 +137,7 @@ func TestInValidateData(t *testing.T) {
} }
func TestInValidateUnmarshalData(t *testing.T) { func TestInValidateUnmarshalData(t *testing.T) {
schemaDir := "../schema_valid/ondc_trv10_2.0.0/" schemaDir := "../testdata/schema_valid/"
if _, err := os.Stat(schemaDir); os.IsNotExist(err) { if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
t.Fatalf("Schema directory does not exist: %v", schemaDir) t.Fatalf("Schema directory does not exist: %v", schemaDir)

View File

@@ -1,217 +0,0 @@
{
"$id": "https://example.com/ondc/trv10/2.0.0",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"search": {
"$id": "search#",
"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"]
}
}
}
}
}

View File

@@ -1,201 +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": {
"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"]
}
}
}
}
}

View File

@@ -1,32 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "cancel",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"cancel"
]
}
},
"required": [
"action"
]
}
]
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "confirm",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"confirm"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "init",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"init"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnCancel",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_cancel"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnConfirm",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_confirm"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnInit",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_init"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnRating",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_rating"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"feedback_form": {
"description": "A feedback form to allow the user to provide additional information on the rating provided",
"allOf": [
{
"$ref": "./definitions.json#/$defs/XInput"
}
]
}
}
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context",
"message"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnSearch",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_search"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"catalog": {
"$ref": "./definitions.json#/$defs/Catalog"
}
},
"required": [
"catalog"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,40 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnSelect",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_select"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
}
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnStatus",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_status"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,40 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnSupport",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_support"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"support": {
"$ref": "./definitions.json#/$defs/Support"
}
}
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnTrack",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_track"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"tracking": {
"$ref": "./definitions.json#/$defs/Tracking"
}
},
"required": [
"tracking"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "OnUpdate",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
"action": {
"enum": [
"on_update"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context"
]
}

View File

@@ -1,42 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "rating",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"rating"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"ratings": {
"type": "array",
"items": {
"$ref": "./definitions.json#/$defs/Rating"
}
}
}
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,7 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "Response",
"type": "object",
"properties": {},
"required": []
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "status",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"status"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"ref_id": {
"$ref": "./definitions.json#/$defs/Order"
},
"order_id": {
"$ref": "./definitions.json#/$defs/Order"
}
}
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,39 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "support",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"support"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"support": {
"$ref": "./definitions.json#/$defs/Support"
}
}
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,47 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "track",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"track"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order_id": {
"$ref": "./definitions.json#/$defs/Order"
},
"callback_url": {
"type": "string",
"format": "uri"
}
},
"required": [
"order_id"
]
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,53 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "update",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"update"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"update_target": {
"description": "Comma separated values of order objects being updated. For example: ```\"update_target\":\"item,billing,fulfillment\"```",
"type": "string"
},
"order": {
"description": "Updated order object",
"allOf": [
{
"$ref": "./definitions.json#/$defs/Order"
}
]
}
},
"required": [
"update_target",
"order"
]
}
},
"required": [
"message",
"context"
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_cancel",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_cancel"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context",
"message"
]
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_confirm",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_confirm"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_init",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_init"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,47 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_rating",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_rating"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"feedback_form": {
"description": "A feedback form to allow the user to provide additional information on the rating provided",
"allOf": [
{
"$ref": "./definitions.json#/$defs/XInput"
}
]
}
}
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context",
"message"
]
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_search",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_search"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"catalog": {
"$ref": "./definitions.json#/$defs/Catalog"
}
},
"required": [
"catalog"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_select",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_select"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
}
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_status",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_status"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,42 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_support",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_support"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"properties": {
"support": {
"$ref": "./definitions.json#/$defs/Support"
}
}
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context",
"message"
]
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_track",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_track"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"tracking": {
"$ref": "./definitions.json#/$defs/Tracking"
}
},
"required": [
"tracking"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"context",
"message"
]
}

View File

@@ -1,46 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_update",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"on_update"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
},
"error": {
"$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,26 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "search",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
}
]
},
"message": {
"properties": {
"intent": {
"$ref": "./definitions.json#/$defs/Intent"
}
},
"type": "object"
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,43 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "select",
"type": "object",
"properties": {
"context": {
"allOf": [
{
"$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
"properties": {
"action": {
"enum": [
"select"
]
}
},
"required": [
"action"
]
}
]
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"order": {
"$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
"order"
]
}
},
"required": [
"message",
"context"
]
}

View File

@@ -1,40 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "cancel",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/cancel.json#"
},
{
"$ref": "init.json#/allOf/2"
},
{
"properties": {
"message": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
},
"descriptor": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": ["SOFT_CANCEL", "CONFIRM_CANCEL"]
}
},
"required": ["code"]
},
"cancellation_reason_id": {
"type": "string",
"pattern": "^[0-9]+$"
}
},
"required": ["order_id", "descriptor", "cancellation_reason_id"]
}
}
}
]
}

View File

@@ -1,463 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "confirm",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
},
{
"$ref": "./init.json#/allOf/2"
},
{
"allOf": [
{
"$ref": "./on_select.json#/allOf/5"
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"type": "array",
"items": {
"allOf": [
{
"properties": {
"customer": {
"properties": {
"contact": {
"properties": {
"phone": {
"type": "string",
"pattern": "^\\+?[1-9]\\d{1,14}$"
}
},
"required": [
"phone"
]
},
"person": {
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
}
},
"required": [
"contact",
"person"
]
}
},
"required": [
"customer"
]
}
]
}
}
}
}
}
}
}
}
]
},
{
"allOf": [
{
"$ref": "./init.json#/allOf/7"
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"payments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"params": {
"type": "object",
"properties": {
"amount": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
},
"type": {
"type": "string",
"enum": [
"PRE-ORDER",
"ON-FULFILLMENT",
"POST-FULFILLMENT"
]
},
"status": {
"type": "string",
"enum": [
"PAID",
"NOT-PAID"
]
},
"collected_by": {
"type": "string",
"enum": [
"BAP",
"BPP"
]
},
"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"
]
}
},
"allOf": [
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "SETTLEMENT_TERMS"
}
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "STATIC_TERMS"
}
}
},
"value": {
"type": "string",
"format": "uri"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_BASIS"
}
}
},
"value": {
"type": "string",
"enum": [
"DELIVERY"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_WINDOW"
}
}
},
"value": {
"type": "string"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "DELAY_INTEREST"
}
}
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_TYPE"
}
}
},
"value": {
"type": "string",
"enum": [
"upi",
"neft",
"rtgs",
"UPI",
"NEFT",
"RTGS"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_AMOUNT"
}
}
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "MANDATORY_ARBITRATION"
}
}
},
"value": {
"type": "string",
"enum": [
"true",
"false"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "COURT_JURISDICTION"
}
}
},
"value": {
"type": "string"
}
}
}
}
]
}
}
}
},
{
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "BUYER_FINDER_FEES"
}
}
}
}
},
"then": {
"properties": {
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"enum": [
"BUYER_FINDER_FEES_PERCENTAGE"
]
}
}
},
"value": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
}
}
}
}
}
}
]
}
},
"required": [
"descriptor"
]
}
}
},
"required": [
"type",
"status",
"collected_by",
"tags"
]
}
}
}
}
}
}
}
}
]
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"payments": {
"type": "array",
"items": {
"properties": {
"type": {
"type": "string"
},
"params": {
"type": "object",
"properties": {
"transaction_id": {
"type": "string"
}
}
}
},
"required": [
"type"
],
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "PRE-ORDER"
}
}
},
"then": {
"properties": {
"params": {
"required": [
"transaction_id"
]
}
}
}
}
]
}
}
},
"required": [
"payments"
]
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"not": {
"required": [
"id"
]
}
}
}
}
}
}
]
}

View File

@@ -1,550 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "init",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/init.json#"
},
{
"properties": {
"context": {
"type": "object",
"allOf": [
{
"$ref": "./search.json#/properties/context/allOf/0"
},
{
"required": [
"bpp_id",
"bpp_uri"
]
}
]
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"type": "object",
"properties": {
"provider": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
}
}
},
"required": [
"provider",
"items"
]
}
}
}
}
},
{
"$ref": "./confirm.json#/allOf/4"
},
{
"$ref": "./on_select.json#"
},
{
"properties": {
"message": {
"properties": {
"order": {
"required": [
"fulfillments"
]
}
}
}
}
},
{
"properties": {
"message": {
"type": "object",
"properties": {
"order": {
"type": "object",
"properties": {
"payments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"params": {
"type": "object",
"properties": {
"amount": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
},
"type": {
"type": "string",
"enum": [
"PRE-ORDER",
"ON-FULFILLMENT",
"POST-FULFILLMENT"
]
},
"status": {
"type": "string",
"enum": [
"PAID",
"NOT-PAID"
]
},
"collected_by": {
"type": "string",
"enum": [
"BAP",
"BPP"
]
},
"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": [
"descriptor"
]
}
}
},
"required": [
"type",
"status",
"collected_by",
"tags"
],
"allOf": [
{
"if": {
"allOf": [
{
"properties": {
"collected_by": {
"const": "BAP"
}
}
},
{
"properties": {
"type": {
"const": "PRE-ORDER"
}
}
}
]
},
"then": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "SETTLEMENT_TERMS"
}
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "STATIC_TERMS"
}
}
},
"value": {
"type": "string",
"format": "uri"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_BASIS"
}
}
},
"value": {
"type": "string",
"enum": [
"DELIVERY"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_WINDOW"
}
}
},
"value": {
"type": "string"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "DELAY_INTEREST"
}
}
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
}
}
]
}
}
}
}
}
}
}
},
{
"if": {
"allOf": [
{
"properties": {
"collected_by": {
"const": "BPP"
}
}
},
{
"properties": {
"type": {
"const": "PRE-ORDER"
}
}
}
]
},
"then": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "SETTLEMENT_TERMS"
}
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "STATIC_TERMS"
}
}
},
"value": {
"type": "string",
"format": "uri"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_BASIS"
}
}
},
"value": {
"type": "string",
"enum": [
"DELIVERY"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_WINDOW"
}
}
},
"value": {
"type": "string"
}
}
}
}
]
}
}
}
}
}
}
}
},
{
"if": {
"allOf": [
{
"properties": {
"collected_by": {
"const": "BPP"
}
}
},
{
"properties": {
"type": {
"const": "ON-FULFILLMENT"
}
}
}
]
},
"then": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "SETTLEMENT_TERMS"
}
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "STATIC_TERMS"
}
}
},
"value": {
"type": "string",
"format": "uri"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_BASIS"
}
}
},
"value": {
"type": "string",
"enum": [
"DELIVERY"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_WINDOW"
}
}
},
"value": {
"type": "string"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "DELAY_INTEREST"
}
}
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
}
}
]
}
}
}
}
}
}
}
}
]
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"billing": {
"required": [
"name"
]
}
},
"required": [
"billing"
]
}
}
}
}
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_cancel",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_confirm",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,317 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_init",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/on_init.json#"
},
{
"$ref": "./init.json#/allOf/1"
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"provider": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": ["id"]
}
},
"required": ["provider"]
}
}
}
}
},
{
"$ref": "./confirm.json#/allOf/5"
},
{
"$ref": "./on_select.json#/allOf/6"
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"items": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"fulfillment_ids": {
"minItems": 1
},
"location_ids": {
"minItems": 1
}
},
"required": ["fulfillment_ids", "location_ids"]
}
}
}
}
}
}
}
},
{
"$ref": "./confirm.json#/allOf/4/allOf/1"
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["DELIVERY"]
}
},
"required": ["type"]
}
}
}
}
}
}
}
},
{
"allOf": [
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"quote": {
"type": "object",
"properties": {
"price": {
"type": "object",
"properties": {
"currency": {
"type": "string"
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
},
"required": ["currency", "value"]
},
"breakup": {
"type": "array",
"items": {
"type": "object",
"properties": {
"price": {
"type": "object",
"properties": {
"currency": {
"type": "string"
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
},
"required": ["currency", "value"]
},
"title": {
"type": "string",
"enum": [
"BASE_FARE",
"DISTANCE_FARE",
"TAX",
"DISCOUNT",
"WAITING_CHARGE"
]
}
},
"required": ["price", "title"]
}
}
},
"required": ["price", "breakup"]
}
},
"required": ["quote"]
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"quote": {
"properties": {
"breakup": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"title": {
"const": "BASE_FARE"
},
"price": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"required": ["value"]
}
},
"required": ["title", "price"]
}
},
{
"contains": {
"type": "object",
"properties": {
"title": {
"const": "DISTANCE_FARE"
},
"price": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"required": ["value"]
}
},
"required": ["title", "price"]
}
}
]
}
}
}
}
}
}
}
}
}
]
},
{
"$ref": "./confirm.json#/allOf/6"
},
{
"allOf": [
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"cancellation_terms": {
"type": "array",
"items": {
"type": "object",
"properties": {
"fulfillment_state": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": [
"RIDE_ASSIGNED",
"RIDE_ENROUTE_PICKUP",
"RIDE_ARRIVED_PICKUP",
"RIDE_STARTED"
]
}
},
"required": ["code"]
}
},
"required": ["descriptor"]
},
"cancellation_fee": {
"oneOf": [
{
"type": "object",
"properties": {
"percentage": {
"type": "string",
"pattern": "^(100(\\.0{1,2})?|([0-9]{1,2})(\\.\\d{1,2})?)$"
}
},
"required": ["percentage"]
},
{
"type": "object",
"properties": {
"amount": {
"type": "object",
"properties": {
"value": {
"type": "string",
"pattern": "^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)$"
},
"currency": {
"type": "string"
}
},
"required": ["currency", "value"]
}
},
"required": ["amount"]
}
]
}
},
"required": ["fulfillment_state", "cancellation_fee"]
}
}
},
"required": ["cancellation_terms"]
}
}
}
}
},
{
"properties": {
"message": {
"type": "object"
}
},
"required": ["message"]
}
]
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_rating",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,645 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_search",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/on_search.json#"
},
{
"$ref": "./init.json#/allOf/1"
},
{
"properties": {
"message": {
"type": "object",
"properties": {
"catalog": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
}
},
"required": [
"name"
]
},
"providers": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"descriptor": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
}
},
"required": [
"name"
]
},
"fulfillments": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"vehicle": {
"type": "object",
"properties": {
"category": {
"type": "string",
"enum": [
"AUTO_RICKSHAW",
"CAB"
]
}
},
"required": [
"category"
]
},
"type": {
"type": "string",
"enum": [
"DELIVERY"
]
}
},
"required": [
"id",
"vehicle",
"type"
]
}
},
"items": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"code": {
"type": "string",
"enum": [
"RIDE"
]
}
},
"required": [
"code"
]
},
"price": {
"type": "object",
"properties": {
"value": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
},
"required": [
"value",
"currency"
]
},
"fulfillment_ids": {
"type": "array",
"minItems": 1
},
"payment_ids": {
"type": "array",
"minItems": 1
}
},
"required": [
"id",
"descriptor",
"price",
"fulfillment_ids"
]
}
}
},
"required": [
"id",
"descriptor",
"items",
"fulfillments"
]
}
}
},
"required": [
"providers"
]
}
},
"required": [
"catalog"
]
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"payments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"collected_by": {
"type": "string",
"enum": [
"BAP",
"BPP"
]
},
"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": [
"descriptor"
]
}
}
},
"required": [
"collected_by",
"tags"
],
"allOf": [
{
"if": {
"allOf": [
{
"properties": {
"collected_by": {
"const": "BAP"
}
}
}
]
},
"then": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "SETTLEMENT_TERMS"
}
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "STATIC_TERMS"
}
}
},
"value": {
"type": "string",
"format": "uri"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_TYPE"
}
}
},
"value": {
"type": "string",
"enum": [
"upi",
"neft",
"rtgs",
"UPI",
"NEFT",
"RTGS"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "DELAY_INTEREST"
}
}
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "MANDATORY_ARBITRATION"
}
}
},
"value": {
"type": "string",
"enum": [
"true",
"false"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "COURT_JURISDICTION"
}
}
},
"value": {
"type": "string"
}
}
}
}
]
}
}
}
}
}
}
}
},
{
"if": {
"allOf": [
{
"properties": {
"collected_by": {
"const": "BPP"
}
}
}
]
},
"then": {
"properties": {
"tags": {
"items": {
"if": {
"properties": {
"descriptor": {
"properties": {
"code": {
"const": "SETTLEMENT_TERMS"
}
}
}
}
},
"then": {
"properties": {
"list": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "STATIC_TERMS"
}
}
},
"value": {
"type": "string",
"format": "uri"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_TYPE"
}
}
},
"value": {
"type": "string",
"enum": [
"upi",
"neft",
"rtgs",
"UPI",
"NEFT",
"RTGS"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "DELAY_INTEREST"
}
}
},
"value": {
"type": "string",
"pattern": "^\\d+(\\.\\d{1,2})?$"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "MANDATORY_ARBITRATION"
}
}
},
"value": {
"type": "string",
"enum": [
"true",
"false"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "COURT_JURISDICTION"
}
}
},
"value": {
"type": "string"
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_BASIS"
}
}
},
"value": {
"type": "string",
"enum": [
"DELIVERY"
]
}
}
}
},
{
"contains": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"const": "SETTLEMENT_WINDOW"
}
}
},
"value": {
"type": "string"
}
}
}
}
]
}
}
}
}
}
}
}
}
]
}
}
},
"required": [
"payments"
]
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"catalog": {
"properties": {
"providers": {
"items": {
"properties": {
"fulfillments": {
"items": {
"properties": {
"stops": {
"allOf": [
{
"contains": {
"type": "object",
"properties": {
"location": {
"type": "object",
"properties": {
"gps": {
"type": "string"
}
},
"required": [
"gps"
]
},
"type": {
"const": "START"
}
},
"required": [
"location",
"type"
]
}
},
{
"contains": {
"type": "object",
"properties": {
"location": {
"type": "object",
"properties": {
"gps": {
"type": "string"
}
},
"required": [
"gps"
]
},
"type": {
"const": "END"
}
},
"required": [
"location",
"type"
]
}
}
]
}
},
"required": [
"stops"
]
}
}
}
}
}
}
}
}
}
}
}
]
}

View File

@@ -1,230 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_select",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/on_select.json#"
},
{
"$ref": "./init.json#/allOf/1"
},
{
"$ref": "./on_init.json#/allOf/2"
},
{
"$ref": "./confirm.json#/allOf/5"
},
{
"$ref": "./on_init.json#/allOf/5"
},
{
"allOf": [
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"type": "array",
"minItems": 1,
"items": {
"required": ["id"]
}
}
},
"required": ["fulfillments"]
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"state": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": [
"RIDE_ASSIGNED",
"RIDE_ENROUTE_PICKUP",
"RIDE_ARRIVED_PICKUP",
"RIDE_STARTED",
"RIDE_ENDED",
"RIDE_CANCELLED"
]
}
},
"required": ["code"]
}
}
}
}
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"type": "array",
"minItems": 1,
"items": {
"properties": {
"stops": {
"items": {
"properties": {
"authorization": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["OTP"]
},
"token": {
"type": "string",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
},
"required": ["type", "token"]
}
}
}
}
}
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"items": {
"properties": {
"stops": {
"type": "array",
"minItems": 2,
"items": {
"type": "object",
"properties": {
"location": {
"type": "object",
"properties": {
"gps": { "type": "string" }
},
"required": ["gps"]
},
"type": {
"enum": ["START", "END"]
}
},
"required": ["location", "type"]
}
}
},
"required": ["stops"]
}
}
}
}
}
}
}
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"vehicle": {
"properties": {
"category": {
"type": "string",
"enum": ["AUTO_RICKSHAW", "CAB"]
}
},
"required": ["category"]
}
},
"required": ["vehicle"]
}
}
},
"required": ["fulfillments"]
}
}
}
}
}
]
},
{
"$ref": "./on_init.json#/allOf/7"
},
{
"properties": {
"message": {
"properties": {
"order": {
"properties": {
"fulfillments": {
"type": "array",
"items": {
"allOf": [
{
"not": {
"required": ["agent"]
}
}
]
}
}
}
}
}
}
}
},
{
"$ref": "./on_init.json#/allOf/8"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_status",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_support",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_track",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "on_update",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/confirm.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "rating",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/rating.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,146 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "search",
"allOf": [
{ "$ref": "../../core/v1.1.0/search.json#" }
],
"type": "object",
"properties": {
"context": {
"type": "object",
"allOf": [
{
"properties": {
"action": {
"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": ["city", "country"]
},
"bap_id": {
"type": "string"
},
"bpp_id": {
"type": "string"
},
"ttl": {
"type": "string",
"format": "duration"
},
"timestamp": {
"type": "string",
"format": "date-time"
}
},
"required": [
"location",
"domain",
"action",
"message_id",
"transaction_id",
"timestamp",
"bap_id",
"bap_uri",
"ttl"
]
}
]
},
"message": {
"type": "object",
"properties": {
"intent": {
"allOf": [
{
"type": "object",
"properties": {
"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": ["descriptor"]
}
}
},
"required": ["collected_by"]
},
"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
}
},
"required": ["stops"]
}
},
"required": ["payment", "fulfillment"]
}
]
}
},
"required": ["intent"]
}
},
"required": ["context", "message"]
}

View File

@@ -1,16 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "select",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/select.json#"
},
{
"$ref": "./init.json#/allOf/1"
},
{
"$ref": "./init.json#/allOf/2"
}
]
}

View File

@@ -1,26 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "status",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/status.json#"
},
{
"$ref": "./init.json#/allOf/1"
},
{
"properties": {
"message": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": ["order_id"]
}
}
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "support",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/support.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "track",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/track.json#"
},
{
"$ref": "./init.json#/allOf/1"
}
]
}

View File

@@ -1,35 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "update",
"type": "object",
"allOf": [
{
"$ref": "../../core/v1.1.0/update.json#"
},
{
"$ref": "./init.json#/allOf/1"
},
{
"properties": {
"message": {
"type": "object",
"properties": {
"order": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": ["id"]
},
"update_target": {
"type": "string",
"pattern": "^[^,]+(,[^,]+)*$"
}
}
}
}
}
]
}

View File

@@ -1,253 +0,0 @@
{
"$id": "https://example.com/ondc/trv10/2.0.0",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"search": {
"$id": "search#",
"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": ["city", "country"]
},
"action": {
"type": "string",
"enum": ["search"]
},
"bap_id": {
"type": "string"
},
"bap_uri": {
"type": "string",
"format": "uri"
},
"bpp_id": {
"type": "string"
},
"bpp_uri": {
"type": "string",
"format": "uri"
},
"transaction_id": {
"type": "string",
"format": "uuid"
},
"message_id": {
"type": "string",
"format": "uuid"
},
"timestamp": {
"type": "string",
"format": "date-time"
},
"ttl": {
"type": "string",
"format": "duration"
}
},
"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"]
}
}
}
}
}

View File

View File

@@ -0,0 +1,129 @@
{
"$id": "http://example.com/schema/searchSchema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"context": {
"type": "object",
"properties": {
"action": { "type": "string" },
"bap_id": { "type": "string" },
"bap_uri": { "type": "string", "format": "uri" },
"domain": { "type": "string" },
"location": {
"type": "object",
"properties": {
"city": {
"type": "object",
"properties": {
"code": { "type": "string" }
},
"required": ["code"]
},
"country": {
"type": "object",
"properties": {
"code": { "type": "string" }
},
"required": ["code"]
}
},
"required": ["city", "country"]
},
"message_id": { "type": "string", "format": "uuid" },
"timestamp": { "type": "string", "format": "date-time" },
"transaction_id": { "type": "string", "format": "uuid" },
"ttl": { "type": "string" },
"version": { "type": "string" }
},
"required": [
"action",
"bap_id",
"bap_uri",
"domain",
"location",
"message_id",
"timestamp",
"transaction_id",
"ttl",
"version"
]
},
"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", "pattern": "^\\d{1,3}\\.\\d+,\\s?\\d{1,3}\\.\\d+$" }
},
"required": ["gps"]
},
"type": { "type": "string", "enum": ["START", "END"] }
},
"required": ["location", "type"]
}
}
},
"required": ["stops"]
},
"payment": {
"type": "object",
"properties": {
"collected_by": { "type": "string", "enum": ["BPP", "BAP"] },
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "type": "string" }
},
"required": ["code"]
},
"display": { "type": "boolean" },
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"descriptor": {
"type": "object",
"properties": {
"code": { "type": "string" }
},
"required": ["code"]
},
"value": { "type": "string" }
},
"required": ["descriptor", "value"]
}
}
},
"required": ["descriptor", "display", "list"]
}
}
},
"required": ["collected_by", "tags"]
}
},
"required": ["fulfillment", "payment"]
}
}
}
},
"required": ["context", "message"]
}