Draft
Conversation
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
cbe1d70 to
57b16d0
Compare
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.
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.v20orocpp.v201shouldn't be affected by introduction ofSchemaValidator. These modules create a default instance ofValidatorto include the right set of schemas.Users of
ocpp.v21can create a custom validator and pass it to the construct ofocpp.v21.ChargePoint. See also the two examples inexamples/v21/.Fixes: #453