Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to provide JSON schemas manually #459

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

OrangeTux
Copy link
Contributor

The OCA doesn't allow to share the JSON schemas for OCPP 2.1 outside it's members. Thus this library can't include these schemas.

This commit introduces the SchemaValidator: a structure that loads schemas located at inprovide folder and validates payload against those schemas. The file names of the schema must follow the format 'Request' or 'Response'. E.g.: "HeartbeatRequest" or
"BootNotificationResponse".

The file names for the schemas of OCPP 1.6 and OCPP 2.0 have been adjusted to follow this pattern.

Users relying on ocpp.v16, ocpp.v20 or ocpp.v201 shouldn't be affected by introduction of SchemaValidator. These modules create a default instance of Validator to include the right set of schemas.

Users of ocpp.v21 can create a custom validator and pass it to the construct of ocpp.v21.ChargePoint. See also the two examples in examples/v21/.

Fixes: #453

@OrangeTux
Copy link
Contributor Author

This PR is currently a draft since it's depending on #452 to be merged first

The OCA doesn't allow to share the JSON schemas for OCPP 2.1 outside
it's members. Thus this library can't include these schemas.

This commit introduces the `SchemaValidator`: a structure that loads
schemas located at inprovide folder and validates payload against those schemas.
The file names of the schema must follow the format '<action>Request' or
'<action>Response'. E.g.: "HeartbeatRequest" or
"BootNotificationResponse".

The file names for the schemas of OCPP 1.6 and OCPP 2.0 have been
adjusted to follow this pattern.

Users relying on `ocpp.v16`, `ocpp.v20` or `ocpp.v201` shouldn't be affected
by introduction of `SchemaValidator`. These modules create a default instance of `Validator`
to include the right set of schemas.

Users of `ocpp.v21` can create a custom validator and pass it to the
construct of `ocpp.v21.ChargePoint`. See also the two examples in
`examples/v21/`.

Fixes: #453
@OrangeTux OrangeTux force-pushed the 453-allow-custom-schemas branch from cbe1d70 to 57b16d0 Compare July 21, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to provide JSON schemas manually.
1 participant