tonyadjei / Open-Charge-Point-Interface-API

A FastAPI RESTful implementation of the sessions module in OCPI (Open Charge Point Interface) for communication b/n EV drivers and Charge Point Operators.
1 stars 0 forks source link

Query regarding OCPI project #1

Open ace-roger opened 1 year ago

ace-roger commented 1 year ago

Hi Anthony Teye-Adjei ,

Great work,

You have implemented the session module of ocpi - any plan on implementing other modules such as location, tariff, reservation, etc.

If not, any suggestions/resources regarding it.

tonyadjei commented 1 year ago

Hey Ace-roger,

I implemented the OCPI modules for version 2.2.1 as part of an internship project I did.

You can use a code generator and an OpenAPI specification file for OCPI to generate a template/boilerplate of the entire API. For example, I used an OpenAPI specification file for OCPI version 2.2 and a FastAPI code generator to generate a FastAPI application with all the OCPI 2.2 endpoints. I then updated the endpoints to match with OCPI 2.2.1 and added the functionality/implementation.

I do not know if there is an OpenAPI specification file for OCPI version 2.2.1 but you can search and see.

Please find below some useful resources: fastapi-code-generator OCPI Github repo OCPI Documentation 2.2.1 ocpi-2.2-openapi-spec.txt

Note: Change the extension of the ocpi-2.2-openapi-spec.txt to .yaml as Github does not support me uploading .yaml files

ace-roger commented 1 year ago

Hi Anthony Teye-Adjei ,

Thanks for responding.

Following the above steps, I am receiving an error: Exception: Modular references are not supported in this version.

tonyadjei commented 1 year ago

I assume the error is coming from the fast-api-code-generator?

ace-roger commented 1 year ago

Yes

tonyadjei commented 1 year ago

Alright, to make things easier for you, here is a starting point of the OCPI 2.2 FastAPI application I used. fastapi-ocpi-initial.zip