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

Add option to disable validation against JSON schemas #54

Closed
OrangeTux opened this issue Dec 2, 2019 · 0 comments · Fixed by #56
Closed

Add option to disable validation against JSON schemas #54

OrangeTux opened this issue Dec 2, 2019 · 0 comments · Fixed by #56
Assignees
Labels
enhancement New feature or request

Comments

@OrangeTux
Copy link
Contributor

TMH has integrated a charge point which isn't fully compliant with the OCPP 1.6 specification. The MeterValues requests send by the charge point contains an 'illegal' measurand. Receiving a MeterValues request will fail with:

Traceback (most recent call last):
File "/venv/lib/python3.7/site-packages/ocpp/messages.py", line 127, in validate_payload
     validate(message.payload, schema)
    File "/venv/lib/python3.7/site-packages/jsonschema/validators.py", line 899, in validate
      raise error
  jsonschema.exceptions.ValidationError: 'Request.Energy' is not one of ['Energy.Active.Export.Register', 'Energy.Active.Import.Register', 'Energy.Reactive.Export.Register', 'Energy.Reactive.Import.Register', 'Energy.Active.Export.Interval', 'Energy.Active.Import.Interval', 'Energy.Reactive.Export.Interval', 'Energy.Reactive.Import.Interval', 'Power.Active.Export', 'Power.Active.Import', 'Power.Offered', 'Power.Reactive.Export', 'Power.Reactive.Import', 'Power.Factor', 'Current.Import', 'Current.Export', 'Current.Offered', 'Voltage', 'Frequency', 'Temperature', 'SoC', 'RPM']

In order to support chargers like this it will be possible to disable JSON schema validation of incoming requests. The validation can be disabled by passing skip_schema_validation=True to a @on decorator. This will disable validation for that specific request and the response.

@on(MeterValues, skip_schema_validation=True)
def on_meter_values(self, *args, **kwargs):
    pass
@OrangeTux OrangeTux added the enhancement New feature or request label Dec 2, 2019
@OrangeTux OrangeTux self-assigned this Dec 2, 2019
@OrangeTux OrangeTux changed the title Add option to disable validation of JSON schema Add option to disable validation against JSON schemas Dec 3, 2019
OrangeTux pushed a commit that referenced this issue Dec 3, 2019
The argument can be used to skip validation of a request and response.
It defaults to `False`, so by default validation is enabled.

The reasoning for this change is that TMH has charge points which use
measurands inside MeterValues messages which are not compliant with the
OCPP 1.6 specification. Therefore the validation of these messages fail.

With this new argument validation of certain messages can be disabled.

Fixes: #54
OrangeTux pushed a commit that referenced this issue Dec 3, 2019
The argument can be used to skip validation of a request and response.
It defaults to `False`, so by default validation is enabled.

The reasoning for this change is that TMH has charge points which use
measurands inside MeterValues messages which are not compliant with the
OCPP 1.6 specification. Therefore the validation of these messages fail.

With this new argument validation of certain messages can be disabled.

Fixes: #54
OrangeTux added a commit that referenced this issue Dec 3, 2019
* Add arg `skip_schema_validation` to @on()

The argument can be used to skip validation of a request and response.
It defaults to `False`, so by default validation is enabled.

The reasoning for this change is that TMH has charge points which use
measurands inside MeterValues messages which are not compliant with the
OCPP 1.6 specification. Therefore the validation of these messages fail.

With this new argument validation of certain messages can be disabled.

Fixes: #54
ajmirsky pushed a commit to ajmirsky/ocpp that referenced this issue Nov 26, 2024
* Add arg `skip_schema_validation` to @on()

The argument can be used to skip validation of a request and response.
It defaults to `False`, so by default validation is enabled.

The reasoning for this change is that TMH has charge points which use
measurands inside MeterValues messages which are not compliant with the
OCPP 1.6 specification. Therefore the validation of these messages fail.

With this new argument validation of certain messages can be disabled.

Fixes: mobilityhouse#54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

1 participant