[OCPP 1.6] setting JSON configuration to include schema validation#1782
Merged
[OCPP 1.6] setting JSON configuration to include schema validation#1782
Conversation
…validation Once an invalid value is allowed then EVerest won't start due to invalid configuration. This fix checks that the new value will pass schema validation before allowing the set to be actioned. Signed-off-by: James Chapman <james.chapman@pionix.de>
Pietfried
previously approved these changes
Feb 4, 2026
| bool ChargePointConfiguration::validate(const std::string_view& schema_file, const json& object) { | ||
| fs::path schema_path = ocpp_main_path / "profile_schemas" / schema_file; | ||
| std::ifstream ifs(schema_path); | ||
| auto schema_json = json::parse(ifs); |
Contributor
There was a problem hiding this comment.
This could be moved inside the try block to avoid issues in case the schema file doesn't exist
Signed-off-by: James Chapman <james.chapman@pionix.de>
Pietfried
approved these changes
Feb 4, 2026
james-ctc
added a commit
that referenced
this pull request
Feb 4, 2026
fix: setting JSON configuration to include schema validation (#1782) Moved validation function to base class and added checks to V2 device model storage (OCPP 1.6) Additional tests to ensure that schema validation on set works for both JSON and database implemantations. Signed-off-by: James Chapman <james.chapman@pionix.de>
james-ctc
added a commit
that referenced
this pull request
Feb 4, 2026
fix: setting JSON configuration to include schema validation (#1782) Moved validation function to base class and added checks to V2 device model storage (OCPP 1.6) Additional tests to ensure that schema validation on set works for both JSON and database implemantations. Signed-off-by: James Chapman <james.chapman@pionix.de>
james-ctc
added a commit
that referenced
this pull request
Feb 5, 2026
fix: setting JSON configuration to include schema validation (#1782) Moved validation function to base class and added checks to V2 device model storage (OCPP 1.6) Additional tests to ensure that schema validation on set works for both JSON and database implemantations. Signed-off-by: James Chapman <james.chapman@pionix.de>
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.
Describe your changes
fix: OCPP 1.6 set could accept invalid values that would fail schema validation
Once an invalid value is allowed then EVerest won't start due to invalid configuration. This fix checks that the new value will pass schema validation before allowing the set to be actioned.
Issue ticket number and link
Checklist before requesting a review