add new schemas
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
plugins:
|
||||
validation_plugin:
|
||||
id: tekuriValidator
|
||||
config:
|
||||
schema_dir: plugins/schemas/
|
||||
config:
|
||||
#schema_dir: plugins/schemas/ #approach 1
|
||||
schema_dir: plugins/schema/ondc_trv10/ #approach 2
|
||||
plugin_path: plugins/implementations/ # Path to the directory containing the .so files
|
||||
@@ -6,9 +6,8 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"beckn-onix/plugins/plugin_definition"
|
||||
"beckn-onix/plugins"
|
||||
|
||||
"github.com/santhosh-tekuri/jsonschema/v6"
|
||||
)
|
||||
@@ -19,157 +18,132 @@ type tekuriValidator struct {
|
||||
}
|
||||
|
||||
type tekuriValidatorProvider struct {
|
||||
//schemaCache map[string]map[string]*jsonschema.Schema
|
||||
schemaCache map[string]*jsonschema.Schema
|
||||
schemaCache map[string]map[string]*jsonschema.Schema
|
||||
//schemaCache map[string]*jsonschema.Schema
|
||||
}
|
||||
|
||||
// Validate validates the given data against the schema.
|
||||
func (v *tekuriValidator) Validate(ctx context.Context, data []byte) error {
|
||||
start := time.Now()
|
||||
// start := time.Now()
|
||||
var jsonData interface{}
|
||||
if err := json.Unmarshal(data, &jsonData); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println("json data : ", jsonData)
|
||||
err := v.schema.Validate(jsonData)
|
||||
if err != nil {
|
||||
fmt.Printf("Validation error: %v\n", err)
|
||||
}
|
||||
fmt.Printf("validate executed in %s\n", time.Since(start))
|
||||
|
||||
// fmt.Printf("validate executed in %s\n", time.Since(start))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
//(Approach 2)(all json files)
|
||||
//(Approach 2)(all json files for each schema)
|
||||
|
||||
// //Initialize reads all .json files from the given schema directory, validates them using JSON Schema, and prints the result.
|
||||
// func (vp *tekuriValidatorProvider) Initialize(schemaDir string) (map[string]plugin_definition.Validator, error) {
|
||||
// start := time.Now()
|
||||
// // Initialize the cache
|
||||
// vp.schemaCache = make(map[string]map[string]*jsonschema.Schema)
|
||||
// validatorCache := make(map[string]plugin_definition.Validator)
|
||||
// Initialize reads all .json files from the given schema directory, validates them using JSON Schema, and prints the result.
|
||||
func (vp *tekuriValidatorProvider) Initialize(schemaDir string) (map[string]plugins.Validator, error) {
|
||||
//start := time.Now()
|
||||
// Initialize the cache
|
||||
vp.schemaCache = make(map[string]map[string]*jsonschema.Schema)
|
||||
validatorCache := make(map[string]plugins.Validator)
|
||||
|
||||
// Read the directory
|
||||
files, err := ioutil.ReadDir(schemaDir)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read schema directory: %v", err)
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
if filepath.Ext(file.Name()) == ".json" {
|
||||
// Read the JSON file
|
||||
filePath := filepath.Join(schemaDir, file.Name())
|
||||
fmt.Println("file path : ", filePath)
|
||||
compiler := jsonschema.NewCompiler()
|
||||
compiledSchema, err := compiler.Compile(filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to compile JSON schema from file %s: %v", file.Name(), err)
|
||||
}
|
||||
if compiledSchema == nil {
|
||||
return nil, fmt.Errorf("compiled schema is nil for file %s", file.Name())
|
||||
}
|
||||
// Extract directory and filename to use in the nested map
|
||||
dir := filepath.Base(filepath.Dir(filePath))
|
||||
if vp.schemaCache[dir] == nil {
|
||||
vp.schemaCache[dir] = make(map[string]*jsonschema.Schema)
|
||||
}
|
||||
// Store the compiled schema in the nested cache
|
||||
vp.schemaCache[dir][file.Name()] = compiledSchema
|
||||
|
||||
validatorCache[file.Name()] = &tekuriValidator{schema: compiledSchema}
|
||||
}
|
||||
}
|
||||
// fmt.Printf("initialize executed in %s\n", time.Since(start))
|
||||
|
||||
return validatorCache, nil
|
||||
}
|
||||
|
||||
// (Approach 1)
|
||||
// func (vp *tekuriValidatorProvider) Initialize(schemaDir string) (map[string]plugins.Validator, error) {
|
||||
// // start := time.Now()
|
||||
// vp.schemaCache = make(map[string]*jsonschema.Schema)
|
||||
// validatorCache := make(map[string]plugins.Validator)
|
||||
|
||||
// // Read the directory
|
||||
// files, err := ioutil.ReadDir(schemaDir)
|
||||
// if err != nil {
|
||||
// return nil, fmt.Errorf("failed to read schema directory: %v", err)
|
||||
// return nil, fmt.Errorf("failed to read schema directory: %w", err)
|
||||
// }
|
||||
|
||||
// for _, file := range files {
|
||||
// if filepath.Ext(file.Name()) == ".json" {
|
||||
// // Read the JSON file
|
||||
// filePath := filepath.Join(schemaDir, file.Name())
|
||||
// compiler := jsonschema.NewCompiler()
|
||||
// compiledSchema, err := compiler.Compile(filePath)
|
||||
// // Read the file content
|
||||
// content, err := ioutil.ReadFile(filePath)
|
||||
// if err != nil {
|
||||
// return nil, fmt.Errorf("failed to compile JSON schema from file %s: %v", file.Name(), err)
|
||||
// return nil, fmt.Errorf("failed to read file %s: %v", filePath, err)
|
||||
// }
|
||||
// if compiledSchema == nil {
|
||||
// return nil, fmt.Errorf("compiled schema is nil for file %s", file.Name())
|
||||
// }
|
||||
// // Extract directory and filename to use in the nested map
|
||||
// dir := filepath.Base(filepath.Dir(filePath))
|
||||
// if vp.schemaCache[dir] == nil {
|
||||
// vp.schemaCache[dir] = make(map[string]*jsonschema.Schema)
|
||||
// }
|
||||
// // Store the compiled schema in the nested cache
|
||||
// vp.schemaCache[dir][file.Name()] = compiledSchema
|
||||
|
||||
// validatorCache[file.Name()] = &tekuriValidator{schema: compiledSchema}
|
||||
// var schemaDoc map[string]interface{}
|
||||
// if err := json.Unmarshal(content, &schemaDoc); err != nil {
|
||||
// return nil, fmt.Errorf("failed to unmarshal JSON schema from file %s: %v", filePath, err)
|
||||
// }
|
||||
|
||||
// if defs, exists := schemaDoc["$defs"]; exists {
|
||||
// defsMap := defs.(map[string]interface{})
|
||||
|
||||
// for name, defSchema := range defsMap {
|
||||
// _, err := json.Marshal(defSchema)
|
||||
// if err != nil {
|
||||
// return nil, fmt.Errorf("failed to marshal schema definition %s: %v", name, err)
|
||||
// }
|
||||
|
||||
// compiler := jsonschema.NewCompiler()
|
||||
// if err := compiler.AddResource(name, filepath.Dir(filePath)); err != nil {
|
||||
// return nil, fmt.Errorf("failed to add resource for schema definition %s: %v", name, err)
|
||||
// }
|
||||
|
||||
// compiledSchema, err := compiler.Compile(filePath)
|
||||
// if err != nil {
|
||||
// return nil, fmt.Errorf("failed to compile schema definition: %v", err)
|
||||
// }
|
||||
|
||||
// schemaKey := fmt.Sprintf("%s.%s", file.Name(), name)
|
||||
// vp.schemaCache[schemaKey] = compiledSchema
|
||||
// validatorCache[schemaKey] = &tekuriValidator{schema: compiledSchema}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fmt.Printf("initialize executed in %s\n", time.Since(start))
|
||||
|
||||
// // fmt.Printf("Initialize executed in %s\n", time.Since(start))
|
||||
// return validatorCache, nil
|
||||
// }
|
||||
|
||||
// func (vp *tekuriValidatorProvider) Get(schemaKey string) (plugin_definition.Validator, error) {
|
||||
// // Extract domain, version, and defKey from the schemaKey
|
||||
// fmt.Println("before printing key :", schemaKey)
|
||||
// schemaKey = strings.Replace(schemaKey, ":", "_", -1)
|
||||
|
||||
// fmt.Println("after printing key :", schemaKey)
|
||||
|
||||
// parts := strings.Split(schemaKey, "_")
|
||||
// if len(parts) != 3 {
|
||||
// return nil, fmt.Errorf("invalid schema key format: %s", schemaKey)
|
||||
// }
|
||||
// domain := parts[0] + "_" + parts[1]
|
||||
// defKey := parts[2]
|
||||
|
||||
// // Look up the compiled schema in the nested map
|
||||
// if domainMap, ok := vp.schemaCache[domain]; ok {
|
||||
// if schema, ok := domainMap[defKey]; ok {
|
||||
// return &tekuriValidator{schema: schema}, nil
|
||||
// }
|
||||
// }
|
||||
// return nil, fmt.Errorf("schema not found: %s", schemaKey)
|
||||
// }
|
||||
|
||||
// (Approach 1)
|
||||
func (vp *tekuriValidatorProvider) Initialize(schemaDir string) (map[string]plugin_definition.Validator, error) {
|
||||
start := time.Now()
|
||||
|
||||
vp.schemaCache = make(map[string]*jsonschema.Schema)
|
||||
validatorCache := make(map[string]plugin_definition.Validator)
|
||||
|
||||
files, err := ioutil.ReadDir(schemaDir)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read schema directory: %w", err)
|
||||
}
|
||||
for _, file := range files {
|
||||
if filepath.Ext(file.Name()) == ".json" {
|
||||
filePath := filepath.Join(schemaDir, file.Name())
|
||||
|
||||
fmt.Println("Compiling filePath:", filePath)
|
||||
|
||||
// Read the file content
|
||||
content, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read file %s: %v", filePath, err)
|
||||
}
|
||||
|
||||
var schemaDoc map[string]interface{}
|
||||
if err := json.Unmarshal(content, &schemaDoc); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal JSON schema from file %s: %v", filePath, err)
|
||||
}
|
||||
|
||||
if defs, exists := schemaDoc["$defs"]; exists {
|
||||
defsMap := defs.(map[string]interface{})
|
||||
|
||||
for name, defSchema := range defsMap {
|
||||
_, err := json.Marshal(defSchema)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal schema definition %s: %v", name, err)
|
||||
}
|
||||
|
||||
compiler := jsonschema.NewCompiler()
|
||||
if err := compiler.AddResource(name, filepath.Dir(filePath)); err != nil {
|
||||
return nil, fmt.Errorf("failed to add resource for schema definition %s: %v", name, err)
|
||||
}
|
||||
|
||||
compiledSchema, err := compiler.Compile(filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to compile schema definition: %v", err)
|
||||
}
|
||||
|
||||
schemaKey := fmt.Sprintf("%s.%s", file.Name(), name)
|
||||
vp.schemaCache[schemaKey] = compiledSchema
|
||||
validatorCache[schemaKey] = &tekuriValidator{schema: compiledSchema}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Printf("Initialize executed in %s\n", time.Since(start))
|
||||
return validatorCache, nil
|
||||
|
||||
}
|
||||
|
||||
// Ensure tekuriValidatorProvider implements ValidatorProvider
|
||||
var _ plugin_definition.ValidatorProvider = (*tekuriValidatorProvider)(nil)
|
||||
var _ plugins.ValidatorProvider = (*tekuriValidatorProvider)(nil)
|
||||
|
||||
var providerInstance = &tekuriValidatorProvider{}
|
||||
|
||||
// Exported function to return the provider instance
|
||||
func GetProvider() plugin_definition.ValidatorProvider {
|
||||
func GetProvider() plugins.ValidatorProvider {
|
||||
return providerInstance
|
||||
}
|
||||
|
||||
179
plugins/implementations/plugin_impl_test.go
Normal file
179
plugins/implementations/plugin_impl_test.go
Normal file
@@ -0,0 +1,179 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type Payload struct {
|
||||
Context Context `json:"context"`
|
||||
Message Message `json:"message"`
|
||||
}
|
||||
|
||||
type Context struct{}
|
||||
|
||||
type Message struct{}
|
||||
|
||||
func TestInitializeValidDirectory(t *testing.T) {
|
||||
provider := &tekuriValidatorProvider{}
|
||||
schemaDir := "../schema/ondc_trv10_2.0.0/"
|
||||
_, err := provider.Initialize(schemaDir)
|
||||
if err != nil {
|
||||
t.Fatalf("expected no error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInitializeInValidDirectory(t *testing.T) {
|
||||
provider := &tekuriValidatorProvider{}
|
||||
schemaDir := "../schemas/ondc_trv10_2.0.0/"
|
||||
_, err := provider.Initialize(schemaDir)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read schema directory: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidCompileFile(t *testing.T) {
|
||||
schemaDir := "../invalid_schemas/"
|
||||
if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
|
||||
t.Fatalf("Schema directory does not exist: %v", schemaDir)
|
||||
}
|
||||
provider := &tekuriValidatorProvider{}
|
||||
compiledSchema, err := provider.Initialize(schemaDir)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to compile JSON schema : %v", err)
|
||||
}
|
||||
if compiledSchema == nil {
|
||||
t.Fatalf("compiled schema is nil : ")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidCompileSchema(t *testing.T) {
|
||||
schemaDir := "../invalid_schemas/invalid_compile_schema/"
|
||||
if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
|
||||
t.Fatalf("Schema directory does not exist: %v", schemaDir)
|
||||
}
|
||||
provider := &tekuriValidatorProvider{}
|
||||
compiledSchema, _ := provider.Initialize(schemaDir)
|
||||
fmt.Println(compiledSchema)
|
||||
if compiledSchema == nil {
|
||||
t.Fatalf("compiled schema is nil : ")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateData(t *testing.T) {
|
||||
schemaDir := "../schema/ondc_trv10_2.0.0/"
|
||||
if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
|
||||
t.Fatalf("Schema directory does not exist: %v", schemaDir)
|
||||
}
|
||||
provider := &tekuriValidatorProvider{}
|
||||
validators, err := provider.Initialize(schemaDir)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to initialize schema provider: %v", err)
|
||||
}
|
||||
var validator *tekuriValidator
|
||||
for _, v := range validators {
|
||||
var ok bool
|
||||
validator, ok = v.(*tekuriValidator)
|
||||
if ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
if validator == nil {
|
||||
t.Fatalf("No validators found in the map")
|
||||
}
|
||||
|
||||
payloadFilePath := "../test/payload.json"
|
||||
payloadData, err := ioutil.ReadFile(payloadFilePath)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to read payload data: %v", err)
|
||||
}
|
||||
var payload Payload
|
||||
err = json.Unmarshal(payloadData, &payload)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to unmarshal payload data: %v", err)
|
||||
}
|
||||
err = validator.Validate(context.Background(), payloadData)
|
||||
if err != nil {
|
||||
t.Errorf("Validation failed: %v", err)
|
||||
} else {
|
||||
fmt.Println("Validation succeeded.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInValidateData(t *testing.T) {
|
||||
schemaDir := "../schema/ondc_trv10_2.0.0/"
|
||||
|
||||
if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
|
||||
t.Fatalf("Schema directory does not exist: %v", schemaDir)
|
||||
}
|
||||
|
||||
provider := &tekuriValidatorProvider{}
|
||||
validators, err := provider.Initialize(schemaDir)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to initialize schema provider: %v", err)
|
||||
}
|
||||
var validator *tekuriValidator
|
||||
for _, v := range validators {
|
||||
var ok bool
|
||||
validator, ok = v.(*tekuriValidator)
|
||||
if ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
if validator == nil {
|
||||
t.Fatalf("No validators found in the map")
|
||||
}
|
||||
invalidPayloadData := []byte(`"invalid": "data"}`)
|
||||
err = validator.Validate(context.Background(), invalidPayloadData)
|
||||
if err != nil {
|
||||
t.Errorf("Validation failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInValidateUnmarshalData(t *testing.T) {
|
||||
schemaDir := "../schema/ondc_trv10_2.0.0/"
|
||||
|
||||
if _, err := os.Stat(schemaDir); os.IsNotExist(err) {
|
||||
t.Fatalf("Schema directory does not exist: %v", schemaDir)
|
||||
}
|
||||
|
||||
provider := &tekuriValidatorProvider{}
|
||||
validators, err := provider.Initialize(schemaDir)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to initialize schema provider: %v", err)
|
||||
}
|
||||
var validator *tekuriValidator
|
||||
for _, v := range validators {
|
||||
var ok bool
|
||||
validator, ok = v.(*tekuriValidator)
|
||||
if ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
if validator == nil {
|
||||
t.Fatalf("No validators found in the map")
|
||||
}
|
||||
invalidPayloadData := []byte(`{"invalid": "data`)
|
||||
err = validator.Validate(context.Background(), invalidPayloadData)
|
||||
if err != nil {
|
||||
t.Errorf("Error while unmarshaling the data: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetProvider(t *testing.T) {
|
||||
expected := providerInstance
|
||||
actual := GetProvider()
|
||||
|
||||
if actual != expected {
|
||||
t.Fatalf("expected %v, got %v", expected, actual)
|
||||
} else {
|
||||
t.Logf("GetProvider returned the expected providerInstance")
|
||||
}
|
||||
}
|
||||
Binary file not shown.
0
plugins/invalid_schemas/init.json
Normal file
0
plugins/invalid_schemas/init.json
Normal file
@@ -9,28 +9,18 @@
|
||||
"context": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"domain": {
|
||||
"type": "string"
|
||||
},
|
||||
"location": {
|
||||
"type": "object",
|
||||
"type": "value",
|
||||
"properties": {
|
||||
"city": {
|
||||
"type": "object",
|
||||
"type": "value",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["code"]
|
||||
},
|
||||
"country": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string",
|
||||
"enum": ["IND"]
|
||||
}
|
||||
},
|
||||
"required": ["code"]
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"beckn-onix/plugins/plugin_definition"
|
||||
//"beckn-onix/plugins/plugin_definition"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"plugin"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
@@ -31,12 +32,16 @@ type PluginDetails struct {
|
||||
|
||||
// PluginManager manages the loading and execution of plugins.
|
||||
type PluginManager struct {
|
||||
validatorProvider plugin_definition.ValidatorProvider
|
||||
validatorProvider ValidatorProvider
|
||||
}
|
||||
|
||||
// NewValidatorProvider initializes the PluginManager with the given configuration.
|
||||
func NewValidatorProvider(pluginsConfig PluginConfig) (*PluginManager, map[string]plugin_definition.Validator, error) {
|
||||
func NewValidatorProvider(pluginsConfig PluginConfig) (*PluginManager, map[string]Validator, error) {
|
||||
start := time.Now()
|
||||
|
||||
var memStatsBefore runtime.MemStats
|
||||
runtime.ReadMemStats(&memStatsBefore)
|
||||
|
||||
validationPlugin := pluginsConfig.Plugins.ValidationPlugin
|
||||
if validationPlugin.ID == "" {
|
||||
return nil, nil, fmt.Errorf("validation_plugin ID is empty")
|
||||
@@ -59,9 +64,9 @@ func NewValidatorProvider(pluginsConfig PluginConfig) (*PluginManager, map[strin
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
getProviderFunc, ok := vpSymbol.(func() plugin_definition.ValidatorProvider)
|
||||
getProviderFunc, ok := vpSymbol.(func() ValidatorProvider)
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("failed to cast to *plugin_definition.ValidatorProvider")
|
||||
return nil, nil, fmt.Errorf("failed to cast to *plugins.ValidatorProvider")
|
||||
}
|
||||
validatorProvider := getProviderFunc()
|
||||
|
||||
@@ -70,14 +75,22 @@ func NewValidatorProvider(pluginsConfig PluginConfig) (*PluginManager, map[strin
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to initialize validator provider: %v", err)
|
||||
}
|
||||
fmt.Println("validators are :", validator)
|
||||
|
||||
fmt.Println("printing validators in new validator provider : ", validator)
|
||||
|
||||
var memStatsAfter runtime.MemStats
|
||||
runtime.ReadMemStats(&memStatsAfter)
|
||||
fmt.Printf("Memory allocated during plugin boot-up: %v MiB", (memStatsAfter.Alloc-memStatsBefore.Alloc)/1024/1024)
|
||||
fmt.Println(" ")
|
||||
|
||||
fmt.Printf("plugin boot-up executed in %s\n", time.Since(start))
|
||||
return &PluginManager{validatorProvider: validatorProvider}, validator, nil
|
||||
}
|
||||
|
||||
// loadPluginsConfig loads the plugins configuration from a YAML file.
|
||||
func LoadPluginsConfig(filePath string) (PluginConfig, error) {
|
||||
start := time.Now()
|
||||
// start := time.Now()
|
||||
|
||||
data, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return PluginConfig{}, err
|
||||
@@ -88,7 +101,7 @@ func LoadPluginsConfig(filePath string) (PluginConfig, error) {
|
||||
if err != nil {
|
||||
return PluginConfig{}, err
|
||||
}
|
||||
fmt.Printf("loadconfig executed in %s\n", time.Since(start))
|
||||
// fmt.Printf("loadconfig executed in %s\n", time.Since(start))
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package plugin_definition
|
||||
package plugins
|
||||
|
||||
import "context"
|
||||
|
||||
BIN
plugins/plugins
BIN
plugins/plugins
Binary file not shown.
0
plugins/schema/beckn_base/api/build.json
Normal file
0
plugins/schema/beckn_base/api/build.json
Normal file
43
plugins/schema/beckn_base/api/io/Init.json
Normal file
43
plugins/schema/beckn_base/api/io/Init.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/init",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"init"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/OnCancel.json
Normal file
43
plugins/schema/beckn_base/api/io/OnCancel.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnCancel",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_cancel"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/OnConfirm.json
Normal file
43
plugins/schema/beckn_base/api/io/OnConfirm.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnConfirm",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_confirm"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/OnInit.json
Normal file
43
plugins/schema/beckn_base/api/io/OnInit.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnInit",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_init"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/OnRating.json
Normal file
46
plugins/schema/beckn_base/api/io/OnRating.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnRating",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.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": "../schema/components.json#/$defs/XInput"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/OnSearch.json
Normal file
43
plugins/schema/beckn_base/api/io/OnSearch.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnSearch",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_search"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"catalog": {
|
||||
"$ref": "../schema/components.json#/$defs/Catalog"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"catalog"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
40
plugins/schema/beckn_base/api/io/OnSelect.json
Normal file
40
plugins/schema/beckn_base/api/io/OnSelect.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnSelect",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_select"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/OnStatus.json
Normal file
43
plugins/schema/beckn_base/api/io/OnStatus.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnStatus",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_status"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
40
plugins/schema/beckn_base/api/io/OnSupport.json
Normal file
40
plugins/schema/beckn_base/api/io/OnSupport.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnSupport",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_support"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"support": {
|
||||
"$ref": "../schema/components.json#/$defs/Support"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/OnTrack.json
Normal file
43
plugins/schema/beckn_base/api/io/OnTrack.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnTrack",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_track"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tracking": {
|
||||
"$ref": "../schema/components.json#/$defs/Tracking"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"tracking"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/OnUpdate.json
Normal file
43
plugins/schema/beckn_base/api/io/OnUpdate.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/OnUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_update"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context"
|
||||
]
|
||||
}
|
||||
42
plugins/schema/beckn_base/api/io/Rating.json
Normal file
42
plugins/schema/beckn_base/api/io/Rating.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/rating",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"rating"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ratings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "../schema/components.json#/$defs/Rating"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
7
plugins/schema/beckn_base/api/io/Response.json
Normal file
7
plugins/schema/beckn_base/api/io/Response.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://beckn.org/schema/Response",
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": []
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/Status.json
Normal file
43
plugins/schema/beckn_base/api/io/Status.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/status",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"status"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"ref_id": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
},
|
||||
"order_id": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
39
plugins/schema/beckn_base/api/io/Support.json
Normal file
39
plugins/schema/beckn_base/api/io/Support.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/support",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"support"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"support": {
|
||||
"$ref": "../schema/components.json#/$defs/Support"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
47
plugins/schema/beckn_base/api/io/Track.json
Normal file
47
plugins/schema/beckn_base/api/io/Track.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/track",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"track"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order_id": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
},
|
||||
"callback_url": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order_id"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
53
plugins/schema/beckn_base/api/io/Update.json
Normal file
53
plugins/schema/beckn_base/api/io/Update.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/update",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.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": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"update_target",
|
||||
"order"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
49
plugins/schema/beckn_base/api/io/cancel.json
Normal file
49
plugins/schema/beckn_base/api/io/cancel.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/cancel",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"cancel"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order_id": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
},
|
||||
"cancellation_reason_id": {
|
||||
"$ref": "../schema/components.json#/$defs/Option"
|
||||
},
|
||||
"descriptor": {
|
||||
"$ref": "../schema/components.json#/$defs/Descriptor"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order_id"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/confirm.json
Normal file
43
plugins/schema/beckn_base/api/io/confirm.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/confirm",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"confirm"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/on_cancel.json
Normal file
46
plugins/schema/beckn_base/api/io/on_cancel.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_cancel",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_cancel"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/on_confirm.json
Normal file
46
plugins/schema/beckn_base/api/io/on_confirm.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_confirm",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_confirm"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/on_init.json
Normal file
46
plugins/schema/beckn_base/api/io/on_init.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_init",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_init"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
47
plugins/schema/beckn_base/api/io/on_rating.json
Normal file
47
plugins/schema/beckn_base/api/io/on_rating.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_rating",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.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": "../schema/components.json#/$defs/XInput"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/on_search.json
Normal file
46
plugins/schema/beckn_base/api/io/on_search.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_search",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_search"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"catalog": {
|
||||
"$ref": "../schema/components.json#/$defs/Catalog"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"catalog"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/on_select.json
Normal file
43
plugins/schema/beckn_base/api/io/on_select.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_select",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_select"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/on_status.json
Normal file
46
plugins/schema/beckn_base/api/io/on_status.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_status",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_status"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
42
plugins/schema/beckn_base/api/io/on_support.json
Normal file
42
plugins/schema/beckn_base/api/io/on_support.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_support",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_support"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"support": {
|
||||
"$ref": "../schema/components.json#/$defs/Support"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/on_track.json
Normal file
46
plugins/schema/beckn_base/api/io/on_track.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_track",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_track"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"tracking": {
|
||||
"$ref": "../schema/components.json#/$defs/Tracking"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"tracking"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/beckn_base/api/io/on_update.json
Normal file
46
plugins/schema/beckn_base/api/io/on_update.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_update",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_update"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
26
plugins/schema/beckn_base/api/io/search.json
Normal file
26
plugins/schema/beckn_base/api/io/search.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/search",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"properties": {
|
||||
"intent": {
|
||||
"$ref": "../schema/components.json#/$defs/Intent"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
43
plugins/schema/beckn_base/api/io/select.json
Normal file
43
plugins/schema/beckn_base/api/io/select.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/select",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"select"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
2459
plugins/schema/beckn_base/api/schema/components.json
Normal file
2459
plugins/schema/beckn_base/api/schema/components.json
Normal file
File diff suppressed because it is too large
Load Diff
43
plugins/schema/ondc_trv10/cancel.json
Normal file
43
plugins/schema/ondc_trv10/cancel.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/cancel",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/cancel.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/cancel#"
|
||||
},
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
466
plugins/schema/ondc_trv10/confirm.json
Normal file
466
plugins/schema/ondc_trv10/confirm.json
Normal file
@@ -0,0 +1,466 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/confirm",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/confirm.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/confirm#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/3"
|
||||
},
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "./on_select.json#/allOf/8/allOf/0"
|
||||
},
|
||||
{
|
||||
"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/6"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
397
plugins/schema/ondc_trv10/init.json
Normal file
397
plugins/schema/ondc_trv10/init.json
Normal file
@@ -0,0 +1,397 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/init",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{ "$ref": "../beckn_base/api/io/init.json#" },
|
||||
{ "$ref": "https://beckn.org/schema/init#" },
|
||||
{
|
||||
"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#/allOf/10" },
|
||||
{
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
46
plugins/schema/ondc_trv10/on_cancel.json
Normal file
46
plugins/schema/ondc_trv10/on_cancel.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_cancel",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_cancel"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/ondc_trv10/on_confirm.json
Normal file
46
plugins/schema/ondc_trv10/on_confirm.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_confirm",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_confirm"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
320
plugins/schema/ondc_trv10/on_init.json
Normal file
320
plugins/schema/ondc_trv10/on_init.json
Normal file
@@ -0,0 +1,320 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_init",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/on_init.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/on_init#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"message": {
|
||||
"properties": {
|
||||
"order": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["id"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$ref": "./on_select.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/5/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/7"
|
||||
},
|
||||
{
|
||||
"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"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
47
plugins/schema/ondc_trv10/on_rating.json
Normal file
47
plugins/schema/ondc_trv10/on_rating.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_rating",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.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": "../schema/components.json#/$defs/XInput"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
648
plugins/schema/ondc_trv10/on_search.json
Normal file
648
plugins/schema/ondc_trv10/on_search.json
Normal file
@@ -0,0 +1,648 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_search",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/on_search.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/on_search#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
827
plugins/schema/ondc_trv10/on_select.json
Normal file
827
plugins/schema/ondc_trv10/on_select.json
Normal file
@@ -0,0 +1,827 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_select",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/on_select.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/on_select#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
},
|
||||
{
|
||||
"$ref": "#/paths/~1on_init/post/requestBody/content/application~1json/schema/allOf/1/allOf/2"
|
||||
},
|
||||
{
|
||||
"$ref": "#/paths/~1on_init/post/requestBody/content/application~1json/schema/allOf/1/allOf/4"
|
||||
},
|
||||
{
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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": "#/paths/~1on_init/post/requestBody/content/application~1json/schema/allOf/1/allOf/6"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"message": {
|
||||
"properties": {
|
||||
"order": {
|
||||
"properties": {
|
||||
"fulfillments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
"not": {
|
||||
"required": ["agent"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$ref": "#/paths/~1on_init/post/requestBody/content/application~1json/schema/allOf/1/allOf/7"
|
||||
}
|
||||
]
|
||||
}
|
||||
46
plugins/schema/ondc_trv10/on_status.json
Normal file
46
plugins/schema/ondc_trv10/on_status.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_status",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_status"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
42
plugins/schema/ondc_trv10/on_support.json
Normal file
42
plugins/schema/ondc_trv10/on_support.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_support",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_support"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"support": {
|
||||
"$ref": "../schema/components.json#/$defs/Support"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/ondc_trv10/on_track.json
Normal file
46
plugins/schema/ondc_trv10/on_track.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_track",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_track"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"tracking": {
|
||||
"$ref": "../schema/components.json#/$defs/Tracking"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"tracking"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
46
plugins/schema/ondc_trv10/on_update.json
Normal file
46
plugins/schema/ondc_trv10/on_update.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/on_update",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../schema/components.json#/$defs/Context"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"enum": [
|
||||
"on_update"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "../schema/components.json#/$defs/Order"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"$ref": "../schema/components.json#/$defs/Error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
16
plugins/schema/ondc_trv10/rating.json
Normal file
16
plugins/schema/ondc_trv10/rating.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/rating",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/rating.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/rating#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
}
|
||||
]
|
||||
}
|
||||
149
plugins/schema/ondc_trv10/search.json
Normal file
149
plugins/schema/ondc_trv10/search.json
Normal file
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/search",
|
||||
"allOf": [
|
||||
{ "$ref": "../beckn_base/api/io/search.json#" },
|
||||
{ "$ref": "https://beckn.org/schema/search#" }
|
||||
],
|
||||
"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",
|
||||
"pattern": "^(?!https?://).*$"
|
||||
},
|
||||
"bpp_id": {
|
||||
"type": "string",
|
||||
"pattern": "^(?!https?://).*$"
|
||||
},
|
||||
"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"]
|
||||
}
|
||||
|
||||
11
plugins/schema/ondc_trv10/select.json
Normal file
11
plugins/schema/ondc_trv10/select.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/select",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{ "$ref": "../beckn_base/api/io/select.json#" },
|
||||
{ "$ref": "https://beckn.org/schema/select#" },
|
||||
{ "$ref": "./init.json#/$defs/init_schema_1" },
|
||||
{ "$ref": "../paths/init.json#/$defs/init_schema_2" }
|
||||
]
|
||||
}
|
||||
29
plugins/schema/ondc_trv10/status.json
Normal file
29
plugins/schema/ondc_trv10/status.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/status",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/status.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/status#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order_id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["order_id"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
16
plugins/schema/ondc_trv10/support.json
Normal file
16
plugins/schema/ondc_trv10/support.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/support",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/support.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/support#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
}
|
||||
]
|
||||
}
|
||||
16
plugins/schema/ondc_trv10/track.json
Normal file
16
plugins/schema/ondc_trv10/track.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/track",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/track.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/track#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
}
|
||||
]
|
||||
}
|
||||
38
plugins/schema/ondc_trv10/update.json
Normal file
38
plugins/schema/ondc_trv10/update.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://ondc.org/trv10/2.0.0/update",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../beckn_base/api/io/update.json#"
|
||||
},
|
||||
{
|
||||
"$ref": "https://beckn.org/schema/update#"
|
||||
},
|
||||
{
|
||||
"$ref": "./init.json#/allOf/2"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["id"]
|
||||
},
|
||||
"update_target": {
|
||||
"type": "string",
|
||||
"pattern": "^[^,]+(,[^,]+)*$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
201
plugins/schema_valid/ondc_trv10_2.0.0/select.json
Normal file
201
plugins/schema_valid/ondc_trv10_2.0.0/select.json
Normal file
@@ -0,0 +1,201 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user