diff --git a/plugins/config.yaml b/plugins/config.yaml
index d7f5274..0feb580 100644
--- a/plugins/config.yaml
+++ b/plugins/config.yaml
@@ -3,5 +3,5 @@ plugins:
id: tekuriValidator
config:
#schema_dir: plugins/schemas/ #approach 1
- schema_dir: plugins/schema/ondc_trv10/ #approach 2
+ schema_dir: plugins/schemas/ #approach 2
plugin_path: plugins/implementations/ # Path to the directory containing the .so files
\ No newline at end of file
diff --git a/plugins/implementations/plugin_impl.go b/plugins/implementations/plugin_impl.go
index fde1fe9..6c7aaa7 100644
--- a/plugins/implementations/plugin_impl.go
+++ b/plugins/implementations/plugin_impl.go
@@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
- "io/ioutil"
+ "os"
"path/filepath"
"beckn-onix/plugins"
@@ -29,7 +29,6 @@ func (v *tekuriValidator) Validate(ctx context.Context, data []byte) error {
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)
@@ -43,47 +42,100 @@ func (v *tekuriValidator) Validate(ctx context.Context, data []byte) error {
//(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]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 2)(all json files for each schema from sub directories)
+
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)
- }
+ // Walk through the directory and compile all .json files
+ err := filepath.Walk(schemaDir, func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ if !info.IsDir() && filepath.Ext(info.Name()) == ".json" {
+ filePath := filepath.Join(schemaDir, info.Name())
+ fmt.Println("printing path : ", path)
+ fmt.Println("Compiling file path: ", filePath)
- 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)
+
+ compiledSchema, err := compiler.Compile(path)
if err != nil {
- return nil, fmt.Errorf("failed to compile JSON schema from file %s: %v", file.Name(), err)
+ return fmt.Errorf("failed to compile JSON schema from file %s: %v", info.Name(), err)
}
if compiledSchema == nil {
- return nil, fmt.Errorf("compiled schema is nil for file %s", file.Name())
+ return fmt.Errorf("compiled schema is nil for file %s", info.Name())
}
- // Extract directory and filename to use in the nested map
+
+ fmt.Printf("Compiled schema for file %s: %+v\n", info.Name(), compiledSchema)
+
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}
+ vp.schemaCache[dir][info.Name()] = compiledSchema
+ validatorCache[info.Name()] = &tekuriValidator{schema: compiledSchema}
}
+ return nil
+ })
+ if err != nil {
+ return nil, fmt.Errorf("failed to read schema directory: %v", err)
}
- // fmt.Printf("initialize executed in %s\n", time.Since(start))
return validatorCache, nil
}
+var _ plugins.ValidatorProvider = (*tekuriValidatorProvider)(nil)
+
+var providerInstance = &tekuriValidatorProvider{}
+
+func GetProvider() plugins.ValidatorProvider {
+ return providerInstance
+}
+
+//////////////////////////////////////////////////////////
// (Approach 1)
// func (vp *tekuriValidatorProvider) Initialize(schemaDir string) (map[string]plugins.Validator, error) {
// // start := time.Now()
@@ -137,13 +189,3 @@ func (vp *tekuriValidatorProvider) Initialize(schemaDir string) (map[string]plug
// // fmt.Printf("Initialize executed in %s\n", time.Since(start))
// return validatorCache, nil
// }
-
-// Ensure tekuriValidatorProvider implements ValidatorProvider
-var _ plugins.ValidatorProvider = (*tekuriValidatorProvider)(nil)
-
-var providerInstance = &tekuriValidatorProvider{}
-
-// Exported function to return the provider instance
-func GetProvider() plugins.ValidatorProvider {
- return providerInstance
-}
diff --git a/plugins/implementations/tekuriValidator.so b/plugins/implementations/tekuriValidator.so
index 031ffc1..166e1fa 100644
Binary files a/plugins/implementations/tekuriValidator.so and b/plugins/implementations/tekuriValidator.so differ
diff --git a/plugins/schema/beckn_base/api/build.json b/plugins/schema/beckn_base/api/build.json
deleted file mode 100644
index e69de29..0000000
diff --git a/plugins/schema/beckn_base/api/io/cancel.json b/plugins/schema/beckn_base/api/io/cancel.json
deleted file mode 100644
index 8828931..0000000
--- a/plugins/schema/beckn_base/api/io/cancel.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schema/beckn_base/api/io/on_rating.json b/plugins/schema/beckn_base/api/io/on_rating.json
deleted file mode 100644
index 8202a00..0000000
--- a/plugins/schema/beckn_base/api/io/on_rating.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schema/beckn_base/api/io/on_support.json b/plugins/schema/beckn_base/api/io/on_support.json
deleted file mode 100644
index a35cef6..0000000
--- a/plugins/schema/beckn_base/api/io/on_support.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schema/beckn_base/api/io/on_track.json b/plugins/schema/beckn_base/api/io/on_track.json
deleted file mode 100644
index 5cccf25..0000000
--- a/plugins/schema/beckn_base/api/io/on_track.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schema/ondc_trv10/on_cancel.json b/plugins/schema/ondc_trv10/on_cancel.json
deleted file mode 100644
index a520787..0000000
--- a/plugins/schema/ondc_trv10/on_cancel.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schema/ondc_trv10/on_confirm.json b/plugins/schema/ondc_trv10/on_confirm.json
deleted file mode 100644
index f534109..0000000
--- a/plugins/schema/ondc_trv10/on_confirm.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schema/ondc_trv10/on_status.json b/plugins/schema/ondc_trv10/on_status.json
deleted file mode 100644
index 62d2268..0000000
--- a/plugins/schema/ondc_trv10/on_status.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schema/ondc_trv10/on_update.json b/plugins/schema/ondc_trv10/on_update.json
deleted file mode 100644
index 376bc3b..0000000
--- a/plugins/schema/ondc_trv10/on_update.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "$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"
- ]
-}
\ No newline at end of file
diff --git a/plugins/schemas/core/v1.1.0/Cancel.json b/plugins/schemas/core/v1.1.0/Cancel.json
new file mode 100644
index 0000000..b09e97a
--- /dev/null
+++ b/plugins/schemas/core/v1.1.0/Cancel.json
@@ -0,0 +1,32 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "cancel",
+ "type": "object",
+ "properties": {
+ "context": {
+ "allOf": [
+ {
+ "$ref": "definitions.json#/$defs/Context"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "action": {
+ "enum": [
+ "cancel"
+ ]
+ }
+ },
+ "required": [
+ "action"
+ ]
+ }
+ ]
+ }
+
+ },
+ "required": [
+ "message",
+ "context"
+ ]
+}
\ No newline at end of file
diff --git a/plugins/schema/beckn_base/api/io/confirm.json b/plugins/schemas/core/v1.1.0/Confirm.json
similarity index 79%
rename from plugins/schema/beckn_base/api/io/confirm.json
rename to plugins/schemas/core/v1.1.0/Confirm.json
index 36d6431..96510ba 100644
--- a/plugins/schema/beckn_base/api/io/confirm.json
+++ b/plugins/schemas/core/v1.1.0/Confirm.json
@@ -1,12 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://ondc.org/trv10/2.0.0/confirm",
+ "$id": "https://beckn.org/schema/confirm",
"type": "object",
"properties": {
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "definitions.json#/$defs/Context"
},
{
"type": "object",
@@ -28,7 +28,7 @@
"additionalProperties": false,
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "definitions.json#/$defs/Order"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/Init.json b/plugins/schemas/core/v1.1.0/Init.json
similarity index 79%
rename from plugins/schema/beckn_base/api/io/Init.json
rename to plugins/schemas/core/v1.1.0/Init.json
index 1c8dccf..a13d644 100644
--- a/plugins/schema/beckn_base/api/io/Init.json
+++ b/plugins/schemas/core/v1.1.0/Init.json
@@ -1,12 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://ondc.org/trv10/2.0.0/init",
+ "$id": "https://beckn.org/schema/init",
"type": "object",
"properties": {
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
@@ -28,7 +28,7 @@
"additionalProperties": false,
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnCancel.json b/plugins/schemas/core/v1.1.0/OnCancel.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/OnCancel.json
rename to plugins/schemas/core/v1.1.0/OnCancel.json
index 284dcb7..2a6c18d 100644
--- a/plugins/schema/beckn_base/api/io/OnCancel.json
+++ b/plugins/schemas/core/v1.1.0/OnCancel.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,7 +26,7 @@
"type": "object",
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
@@ -34,7 +34,7 @@
]
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnConfirm.json b/plugins/schemas/core/v1.1.0/OnConfirm.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/OnConfirm.json
rename to plugins/schemas/core/v1.1.0/OnConfirm.json
index d7450df..c0b4d8b 100644
--- a/plugins/schema/beckn_base/api/io/OnConfirm.json
+++ b/plugins/schemas/core/v1.1.0/OnConfirm.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,7 +26,7 @@
"type": "object",
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
@@ -34,7 +34,7 @@
]
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnInit.json b/plugins/schemas/core/v1.1.0/OnInit.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/OnInit.json
rename to plugins/schemas/core/v1.1.0/OnInit.json
index 2c9a1a4..6092399 100644
--- a/plugins/schema/beckn_base/api/io/OnInit.json
+++ b/plugins/schemas/core/v1.1.0/OnInit.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,7 +26,7 @@
"type": "object",
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
@@ -34,7 +34,7 @@
]
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnRating.json b/plugins/schemas/core/v1.1.0/OnRating.json
similarity index 81%
rename from plugins/schema/beckn_base/api/io/OnRating.json
rename to plugins/schemas/core/v1.1.0/OnRating.json
index bf9c67d..83a0f22 100644
--- a/plugins/schema/beckn_base/api/io/OnRating.json
+++ b/plugins/schemas/core/v1.1.0/OnRating.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -29,14 +29,14 @@
"description": "A feedback form to allow the user to provide additional information on the rating provided",
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/XInput"
+ "$ref": "./definitions.json#/$defs/XInput"
}
]
}
}
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnSearch.json b/plugins/schemas/core/v1.1.0/OnSearch.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/OnSearch.json
rename to plugins/schemas/core/v1.1.0/OnSearch.json
index bde0ff9..b133a81 100644
--- a/plugins/schema/beckn_base/api/io/OnSearch.json
+++ b/plugins/schemas/core/v1.1.0/OnSearch.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,7 +26,7 @@
"type": "object",
"properties": {
"catalog": {
- "$ref": "../schema/components.json#/$defs/Catalog"
+ "$ref": "./definitions.json#/$defs/Catalog"
}
},
"required": [
@@ -34,7 +34,7 @@
]
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnSelect.json b/plugins/schemas/core/v1.1.0/OnSelect.json
similarity index 77%
rename from plugins/schema/beckn_base/api/io/OnSelect.json
rename to plugins/schemas/core/v1.1.0/OnSelect.json
index 8a9cbc6..1404d31 100644
--- a/plugins/schema/beckn_base/api/io/OnSelect.json
+++ b/plugins/schemas/core/v1.1.0/OnSelect.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,12 +26,12 @@
"type": "object",
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
}
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnStatus.json b/plugins/schemas/core/v1.1.0/OnStatus.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/OnStatus.json
rename to plugins/schemas/core/v1.1.0/OnStatus.json
index b450e52..8459e82 100644
--- a/plugins/schema/beckn_base/api/io/OnStatus.json
+++ b/plugins/schemas/core/v1.1.0/OnStatus.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,7 +26,7 @@
"type": "object",
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
@@ -34,7 +34,7 @@
]
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnSupport.json b/plugins/schemas/core/v1.1.0/OnSupport.json
similarity index 77%
rename from plugins/schema/beckn_base/api/io/OnSupport.json
rename to plugins/schemas/core/v1.1.0/OnSupport.json
index 8ec4ed7..226aa3b 100644
--- a/plugins/schema/beckn_base/api/io/OnSupport.json
+++ b/plugins/schemas/core/v1.1.0/OnSupport.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,12 +26,12 @@
"type": "object",
"properties": {
"support": {
- "$ref": "../schema/components.json#/$defs/Support"
+ "$ref": "./definitions.json#/$defs/Support"
}
}
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnTrack.json b/plugins/schemas/core/v1.1.0/OnTrack.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/OnTrack.json
rename to plugins/schemas/core/v1.1.0/OnTrack.json
index 5abaa84..ab06934 100644
--- a/plugins/schema/beckn_base/api/io/OnTrack.json
+++ b/plugins/schemas/core/v1.1.0/OnTrack.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,7 +26,7 @@
"type": "object",
"properties": {
"tracking": {
- "$ref": "../schema/components.json#/$defs/Tracking"
+ "$ref": "./definitions.json#/$defs/Tracking"
}
},
"required": [
@@ -34,7 +34,7 @@
]
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/OnUpdate.json b/plugins/schemas/core/v1.1.0/OnUpdate.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/OnUpdate.json
rename to plugins/schemas/core/v1.1.0/OnUpdate.json
index a974a86..53038d1 100644
--- a/plugins/schema/beckn_base/api/io/OnUpdate.json
+++ b/plugins/schemas/core/v1.1.0/OnUpdate.json
@@ -6,7 +6,7 @@
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"properties": {
@@ -26,7 +26,7 @@
"type": "object",
"properties": {
"order": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
},
"required": [
@@ -34,7 +34,7 @@
]
},
"error": {
- "$ref": "../schema/components.json#/$defs/Error"
+ "$ref": "./definitions.json#/$defs/Error"
}
},
"required": [
diff --git a/plugins/schema/beckn_base/api/io/Rating.json b/plugins/schemas/core/v1.1.0/Rating.json
similarity index 78%
rename from plugins/schema/beckn_base/api/io/Rating.json
rename to plugins/schemas/core/v1.1.0/Rating.json
index 43f0391..61bd2f3 100644
--- a/plugins/schema/beckn_base/api/io/Rating.json
+++ b/plugins/schemas/core/v1.1.0/Rating.json
@@ -1,12 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://ondc.org/trv10/2.0.0/rating",
+ "$id": "https://beckn.org/schema/rating",
"type": "object",
"properties": {
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
@@ -29,7 +29,7 @@
"ratings": {
"type": "array",
"items": {
- "$ref": "../schema/components.json#/$defs/Rating"
+ "$ref": "./definitions.json#/$defs/Rating"
}
}
}
diff --git a/plugins/schema/beckn_base/api/io/Response.json b/plugins/schemas/core/v1.1.0/Response.json
similarity index 100%
rename from plugins/schema/beckn_base/api/io/Response.json
rename to plugins/schemas/core/v1.1.0/Response.json
diff --git a/plugins/schema/beckn_base/api/io/Status.json b/plugins/schemas/core/v1.1.0/Status.json
similarity index 74%
rename from plugins/schema/beckn_base/api/io/Status.json
rename to plugins/schemas/core/v1.1.0/Status.json
index 219b48f..4a5947a 100644
--- a/plugins/schema/beckn_base/api/io/Status.json
+++ b/plugins/schemas/core/v1.1.0/Status.json
@@ -1,12 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://ondc.org/trv10/2.0.0/status",
+ "$id": "https://beckn.org/schema/status",
"type": "object",
"properties": {
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
@@ -28,10 +28,10 @@
"additionalProperties": false,
"properties": {
"ref_id": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
},
"order_id": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
}
}
diff --git a/plugins/schema/beckn_base/api/io/Support.json b/plugins/schemas/core/v1.1.0/Support.json
similarity index 77%
rename from plugins/schema/beckn_base/api/io/Support.json
rename to plugins/schemas/core/v1.1.0/Support.json
index 962536d..9b39df5 100644
--- a/plugins/schema/beckn_base/api/io/Support.json
+++ b/plugins/schemas/core/v1.1.0/Support.json
@@ -1,12 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://ondc.org/trv10/2.0.0/support",
+ "$id": "https://beckn.org/schema/support",
"type": "object",
"properties": {
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
@@ -27,7 +27,7 @@
"type": "object",
"properties": {
"support": {
- "$ref": "../schema/components.json#/$defs/Support"
+ "$ref": "./definitions.json#/$defs/Support"
}
}
}
diff --git a/plugins/schema/beckn_base/api/io/Track.json b/plugins/schemas/core/v1.1.0/Track.json
similarity index 81%
rename from plugins/schema/beckn_base/api/io/Track.json
rename to plugins/schemas/core/v1.1.0/Track.json
index eca39d3..5fabb7e 100644
--- a/plugins/schema/beckn_base/api/io/Track.json
+++ b/plugins/schemas/core/v1.1.0/Track.json
@@ -1,12 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://ondc.org/trv10/2.0.0/track",
+ "$id": "https://beckn.org/schema/track",
"type": "object",
"properties": {
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
@@ -28,7 +28,7 @@
"additionalProperties": false,
"properties": {
"order_id": {
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
},
"callback_url": {
"type": "string",
diff --git a/plugins/schema/beckn_base/api/io/Update.json b/plugins/schemas/core/v1.1.0/Update.json
similarity index 85%
rename from plugins/schema/beckn_base/api/io/Update.json
rename to plugins/schemas/core/v1.1.0/Update.json
index d8fd349..dda31f4 100644
--- a/plugins/schema/beckn_base/api/io/Update.json
+++ b/plugins/schemas/core/v1.1.0/Update.json
@@ -1,12 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://ondc.org/trv10/2.0.0/update",
+ "$id": "https://beckn.org/schema/update",
"type": "object",
"properties": {
"context": {
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Context"
+ "$ref": "./definitions.json#/$defs/Context"
},
{
"type": "object",
@@ -35,7 +35,7 @@
"description": "Updated order object",
"allOf": [
{
- "$ref": "../schema/components.json#/$defs/Order"
+ "$ref": "./definitions.json#/$defs/Order"
}
]
}
diff --git a/plugins/schema/beckn_base/api/schema/components.json b/plugins/schemas/core/v1.1.0/definitions.json
similarity index 98%
rename from plugins/schema/beckn_base/api/schema/components.json
rename to plugins/schemas/core/v1.1.0/definitions.json
index ce94b89..4c82c20 100644
--- a/plugins/schema/beckn_base/api/schema/components.json
+++ b/plugins/schemas/core/v1.1.0/definitions.json
@@ -1,9 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "$id": "https://beckn.org/schema/components",
+ "$id": "definitions.json",
"$defs": {
"Ack": {
- "$id": "#Ack",
+ "$id": "Ack",
"description": "Describes the acknowledgement sent in response to an API call. If the implementation uses HTTP/S, then Ack must be returned in the same session. Every API call to a BPP must be responded to with an Ack whether the BPP intends to respond with a callback or not. This has one property called `status` that indicates the status of the Acknowledgement.",
"type": "object",
"additionalProperties": false,
@@ -26,7 +26,7 @@
}
},
"AddOn": {
- "$id": "#AddOn",
+ "$id": "AddOn",
"description": "Describes an additional item offered as a value-addition to a product or service. This does not exist independently in a catalog and is always associated with an item.",
"type": "object",
"additionalProperties": false,
@@ -47,12 +47,12 @@
}
},
"Address": {
- "$id": "#Address",
+ "$id": "Address",
"description": "Describes a postal address.",
"type": "string"
},
"Agent": {
- "$id": "#Agent",
+ "$id": "Agent",
"description": "Describes the direct performer, driver or executor that fulfills an order. It is usually a person. But in some rare cases, it could be a non-living entity like a drone, or a bot. Some examples of agents are Doctor in the healthcare sector, a driver in the mobility sector, or a delivery person in the logistics sector. This object can be set at any stage of the order lifecycle. This can be set at the discovery stage when the BPP wants to provide details on the agent fulfilling the order, like in healthcare, where the doctor's name appears during search. This object can also used to search for a particular person that the customer wants fulfilling an order. Sometimes, this object gets instantiated after the order is confirmed, like in the case of on-demand taxis, where the driver is assigned after the user confirms the ride.",
"type": "object",
"additionalProperties": false,
@@ -72,7 +72,7 @@
}
},
"Authorization": {
- "$id": "#Authorization",
+ "$id": "Authorization",
"description": "Describes an authorization mechanism used to start or end the fulfillment of an order. For example, in the mobility sector, the driver may require a one-time password to initiate the ride. In the healthcare sector, a patient may need to provide a password to open a video conference link during a teleconsultation.",
"type": "object",
"additionalProperties": false,
@@ -102,7 +102,7 @@
}
},
"Billing": {
- "$id": "#Billing",
+ "$id": "Billing",
"description": "Describes the billing details of an entity.
This has properties like name,organization,address,email,phone,time,tax_number, created_at,updated_at",
"type": "object",
"additionalProperties": false,
@@ -167,7 +167,7 @@
}
},
"Cancellation": {
- "$id": "#Cancellation",
+ "$id": "Cancellation",
"description": "Describes a cancellation event",
"type": "object",
"additionalProperties": false,
@@ -203,7 +203,7 @@
}
},
"CancellationTerm": {
- "$id": "#CancellationTerm",
+ "$id": "CancellationTerm",
"description": "Describes the cancellation terms of an item or an order. This can be referenced at an item or order level. Item-level cancellation terms can override the terms at the order level.",
"type": "object",
"additionalProperties": false,
@@ -240,7 +240,7 @@
}
},
"Catalog": {
- "$id": "#Catalog",
+ "$id": "Catalog",
"description": "Describes the products or services offered by a BPP. This is typically sent as the response to a search intent from a BAP. The payment terms, offers and terms of fulfillment supported by the BPP can also be included here. The BPP can show hierarchical nature of products/services in its catalog using the parent_category_id in categories. The BPP can also send a ttl (time to live) in the context which is the duration for which a BAP can cache the catalog and use the cached catalog.
This has properties like bbp/descriptor,bbp/categories,bbp/fulfillments,bbp/payments,bbp/offers,bbp/providers and exp
This is used in the following situations.