The tool is a NODE.js based utility to check the conformance and compliance of the API logs for logistics and B2B based on the examples in the API Contract.
Log Validation Tool requires Node.js to run.
- Clone the repository, navigate to log-validation-utility and install the dependencies.
cd log-validation-utility
npm i
-
Move all the API payloads inside "/public/logs" folder or mention the path to the logs folder as demonstrated in the next step.
-
Run the utility in the following format
node index.js "domain" "/path/to/logs/folder/"
node index.js logistics ./public/logs/
node index.js b2b ./public/logs/
- A text report (log_report.json) will be generated upon successful execution of the utility.
Notes:
There must be a separate payload for every API.
The utility validates all the payloads as documented in the examples for respective domains:
Sample payload for search.json is demonstrated below:
{
"context":
{
"domain":"ONDC:RET10",
"location": {
"city": {
"code": "std:080"
},
"country": {
"code": "IND"
}
},
"action":"search",
"version":"2.0.1",
"bap_id":"buyerapp.com",
"bap_uri":"https://buyerapp.com/grocery",
"transaction_id":"T1",
"message_id":"M1",
"timestamp":"2023-01-08T22:00:00.000Z",
"ttl":"PT30S"
},
"message":
{
"intent":
{
"item":
{
"descriptor":
{
"name":"oil"
}
},
"fulfillment":
{
"type":"Delivery",
"stops":
[
{
"type":"end",
"location":
{
"gps":"1.3806217468119772, 103.74636438437074",
"area_code":"680230"
}
}
]
},
"payment":
{
"type":"ON-FULFILLMENT"
},
"tags":
[
{
"descriptor": {
"code":"bap_terms"
},
"list":
[
{
"descriptor": {
"code":"finder_fee_type"
},
"value":"percent"
},
{
"descriptor": {
"code":"finder_fee_amount"
},
"value":"0"
}
]
}
]
}
}
}
- Community contributions are welcomed to enhance this utility for future releases.