Refactor OCPI adapter into sdk-like modular components & bug fixes - #3
Draft
ameetdesh wants to merge 37 commits into
Draft
Refactor OCPI adapter into sdk-like modular components & bug fixes#3ameetdesh wants to merge 37 commits into
ameetdesh wants to merge 37 commits into
Conversation
…rver ill-formed response. Fixed non0functional select & init flows. Now they actually ping ocpi server for availability and respond.
…m protocol spec repo
ameetdesh
marked this pull request as ready for review
November 19, 2025 05:34
nirmalnr
reviewed
Nov 19, 2025
| // Start the server | ||
| app.listen(config.port, () => { | ||
| console.log(`[${new Date().toISOString()}] Server is running on http://localhost:${config.port}`); | ||
| }); |
Collaborator
There was a problem hiding this comment.
// Start the server
app.listen(config.port, () => {
console.log(`[${new Date().toISOString()}] Server is running on http://localhost/:${config.port}`);
}).on('error', (error: Error) => {
console.error(`[${new Date().toISOString()}] Failed to start server:`, error);
process.exit(1);
});Will show error if server start fails
Collaborator
|
Can we recheck if the v1 schema is as expected or not. I was able to get the following on_search for v1: {
"context": {
"domain": "deg",
"action": "on_search",
"version": "1.0.0",
"bap_id": "bookmycharger.com",
"bap_uri": "https://api.bookmycharger.com/v1",
"transaction_id": "e6d86146-92b9-44c5-9581-f6be88f14e42",
"message_id": "search-1111-2222-3333-4444",
"timestamp": "2025-11-19T10:02:01.301Z",
"location": {},
"bpp_id": "connector-bpp",
"bpp_uri": "https://bpp_url.com/"
},
"message": {
"catalog": {
"@context": "https://becknprotocol.io/schemas/core/v1/Catalog/schema-context.jsonld",
"@type": "Catalog",
"beckn:id": "catalog-1",
"beckn:items": [
{
"id": "HrKNUxJ9Ara6AL6PaUlF|v5bXyAlSr8G6lvUAN1A_1|1|dz2SXdIDJDfNjsPfw",
"descriptor": {
"name": "Test QR Code - T",
"code": "energy"
},
"tags": [
{
"descriptor": {
"code": "connector-specifications",
"name": "Connector Specifications"
},
"list": [
{
"descriptor": {
"name": "connector Id",
"code": "connector-id"
},
"value": "1"
},
{
"descriptor": {
"name": "Connector Type",
"code": "connector_type"
},
"value": "IEC_62196_T2"
},
{
"descriptor": {
"name": "Power Type",
"code": "power_type"
},
"value": "AC_3_PHASE"
}
]
}
],
"price": {
"currency": "INR/kWh",
"value": "12.00"
},
"location_ids": [
"HrKNUxJ9Ara6AL6PaUlF"
],
"beckn:provider": {
"beckn:id": "THP-HrKNUxJ9Ara6AL6PaUlF",
"beckn:descriptor": {
"@type": "beckn:Descriptor",
"schema:name": "Thunder Plus"
}
},
"beckn:availableAt": [
{
"geo": {
"type": "Point",
"coordinates": [
77.2584309,
28.5503906
]
}
}
]
},
{
"id": "HrKNUxJ9Ara6AL6PaUlF|v5bXyAlSr8G6lvUAN1A_2|1|dz2SXdIDJDfNjsPfw",
"descriptor": {
"name": "Test QR Code - T",
"code": "energy"
},
"tags": [
{
"descriptor": {
"code": "connector-specifications",
"name": "Connector Specifications"
},
"list": [
{
"descriptor": {
"name": "connector Id",
"code": "connector-id"
},
"value": "1"
},
{
"descriptor": {
"name": "Connector Type",
"code": "connector_type"
},
"value": "IEC_62196_T2"
},
{
"descriptor": {
"name": "Power Type",
"code": "power_type"
},
"value": "AC_3_PHASE"
}
]
}
],
"price": {
"currency": "INR/kWh",
"value": "12.00"
},
"location_ids": [
"HrKNUxJ9Ara6AL6PaUlF"
],
"beckn:provider": {
"beckn:id": "THP-HrKNUxJ9Ara6AL6PaUlF",
"beckn:descriptor": {
"@type": "beckn:Descriptor",
"schema:name": "Thunder Plus"
}
},
"beckn:availableAt": [
{
"geo": {
"type": "Point",
"coordinates": [
77.2584309,
28.5503906
]
}
}
]
},
{
"id": "HrKNUxJ9Ara6AL6PaUlF|af7c3MVQklXwBshPj8_2|1|ajcx2DQt07uERmEqprnQ",
"descriptor": {
"name": "Testing",
"code": "energy"
},
"tags": [
{
"descriptor": {
"code": "connector-specifications",
"name": "Connector Specifications"
},
"list": [
{
"descriptor": {
"name": "connector Id",
"code": "connector-id"
},
"value": "1"
},
{
"descriptor": {
"name": "Connector Type",
"code": "connector_type"
},
"value": "IEC_60309_2_three_16"
},
{
"descriptor": {
"name": "Power Type",
"code": "power_type"
},
"value": "AC_1_PHASE"
}
]
}
],
"price": {
"currency": "INR/kWh",
"value": "20.00"
},
"location_ids": [
"HrKNUxJ9Ara6AL6PaUlF"
],
"beckn:provider": {
"beckn:id": "THP-HrKNUxJ9Ara6AL6PaUlF",
"beckn:descriptor": {
"@type": "beckn:Descriptor",
"schema:name": "Thunder Plus"
}
},
"beckn:availableAt": [
{
"geo": {
"type": "Point",
"coordinates": [
77.2584309,
28.5503906
]
}
}
]
},
{
"id": "HrKNUxJ9Ara6AL6PaUlF|af7c3MVQklXwBshPj8_1|1|ajcx2DQt07uERmEqprnQ",
"descriptor": {
"name": "Testing",
"code": "energy"
},
"tags": [
{
"descriptor": {
"code": "connector-specifications",
"name": "Connector Specifications"
},
"list": [
{
"descriptor": {
"name": "connector Id",
"code": "connector-id"
},
"value": "1"
},
{
"descriptor": {
"name": "Connector Type",
"code": "connector_type"
},
"value": "DOMESTIC_D"
},
{
"descriptor": {
"name": "Power Type",
"code": "power_type"
},
"value": "AC_1_PHASE"
}
]
}
],
"price": {
"currency": "INR/kWh",
"value": "20.00"
},
"location_ids": [
"HrKNUxJ9Ara6AL6PaUlF"
],
"beckn:provider": {
"beckn:id": "THP-HrKNUxJ9Ara6AL6PaUlF",
"beckn:descriptor": {
"@type": "beckn:Descriptor",
"schema:name": "Thunder Plus"
}
},
"beckn:availableAt": [
{
"geo": {
"type": "Point",
"coordinates": [
77.2584309,
28.5503906
]
}
}
]
},
{
"id": "HrKNUxJ9Ara6AL6PaUlF|tLAj42jrr0dYtDqdqTDK_1|1|ajcx2DQt07uERmEqprnQ",
"descriptor": {
"name": "Thunder+ Test CP",
"code": "energy"
},
"tags": [
{
"descriptor": {
"code": "connector-specifications",
"name": "Connector Specifications"
},
"list": [
{
"descriptor": {
"name": "connector Id",
"code": "connector-id"
},
"value": "1"
},
{
"descriptor": {
"name": "Connector Type",
"code": "connector_type"
},
"value": "IEC_62196_T2"
},
{
"descriptor": {
"name": "Power Type",
"code": "power_type"
},
"value": "AC_3_PHASE"
}
]
}
],
"price": {
"currency": "INR/kWh",
"value": "20.00"
},
"location_ids": [
"HrKNUxJ9Ara6AL6PaUlF"
],
"beckn:provider": {
"beckn:id": "THP-HrKNUxJ9Ara6AL6PaUlF",
"beckn:descriptor": {
"@type": "beckn:Descriptor",
"schema:name": "Thunder Plus"
}
},
"beckn:availableAt": [
{
"geo": {
"type": "Point",
"coordinates": [
77.2584309,
28.5503906
]
}
}
]
},
{
"id": "HrKNUxJ9Ara6AL6PaUlF|tLAj42jrr0dYtDqdqTDK_2|1|ajcx2DQt07uERmEqprnQ",
"descriptor": {
"name": "Thunder+ Test CP",
"code": "energy"
},
"tags": [
{
"descriptor": {
"code": "connector-specifications",
"name": "Connector Specifications"
},
"list": [
{
"descriptor": {
"name": "connector Id",
"code": "connector-id"
},
"value": "1"
},
{
"descriptor": {
"name": "Connector Type",
"code": "connector_type"
},
"value": "DOMESTIC_D"
},
{
"descriptor": {
"name": "Power Type",
"code": "power_type"
},
"value": "AC_1_PHASE"
}
]
}
],
"price": {
"currency": "INR/kWh",
"value": "20.00"
},
"location_ids": [
"HrKNUxJ9Ara6AL6PaUlF"
],
"beckn:provider": {
"beckn:id": "THP-HrKNUxJ9Ara6AL6PaUlF",
"beckn:descriptor": {
"@type": "beckn:Descriptor",
"schema:name": "Thunder Plus"
}
},
"beckn:availableAt": [
{
"geo": {
"type": "Point",
"coordinates": [
77.2584309,
28.5503906
]
}
}
]
}
]
}
}
}I think |
ameetdesh
marked this pull request as draft
November 19, 2025 17:16
Contributor
Author
|
converting to draft to fix Nirmal's findings. |
…hema from specs/beckn-schemas/becknv1. This schema may be wrong.. will fix that in a followup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref_docs/specs_yaml/simple-energy_EV_1.1.0_openapi_3.1.yamlwith modular v1 yaml files fromhttps://github.com/beckn/protocol-specifications-new. Earlier file was giving serialization error due to long monolithic lines, after the package refactor.beckn:idwas a very long string due to concatenation of base64 encoding for provider, evse, tariff and connector. It was replaced by a shorter id,provider|evse|tariff|connectorformat. This helps keep json payloads smaller.on_selectandon_initcalls were not hitting the OCPI server, and refreshing of cache was hitting it thrice. These bugs are fixed now.P.S. due to size of refactor, I did an overwrite of remote changes by always choosing this branch,
git merge -s ours upstream/main. Going forward this will NOT be done, as the diffs are expected to be smaller and reviewable.