Skip to content

fix: OCPP 2.0.1 schema conformance fixes#418

Open
andig wants to merge 14 commits intolorenzodonini:masterfrom
evcc-io:fix/ocpp201-schema-conformance
Open

fix: OCPP 2.0.1 schema conformance fixes#418
andig wants to merge 14 commits intolorenzodonini:masterfrom
evcc-io:fix/ocpp201-schema-conformance

Conversation

@andig
Copy link
Copy Markdown
Contributor

@andig andig commented Apr 16, 2026

Summary

Fixes multiple OCPP 2.0.1 schema conformance issues discovered by validating Go types against the official JSON schemas.

CRITICAL fixes:

  • CompositeSchedule: Completely redesigned struct to match schema - replaced incorrect StartDateTime + ChargingSchedule with correct flat structure: evseId, duration, scheduleStart, chargingRateUnit, chargingSchedulePeriod
  • ChargingSchedulePeriod: Added missing phaseToUse field (integer 1-3) for AC phase switching support
  • IdTokenInfo: Added missing evseId array field to restrict token validity to specific EVSEs
  • GetVariableResult: Added missing attributeStatusInfo field for detailed status info
  • GetVariableResult.AttributeValue: Fixed maxLength from 1000 to 2500 per schema

HIGH fixes:

  • OCSPRequestDataType.ResponderURL: Made required per schema (removed omitempty)
  • ConsumptionCost.Cost: Added minItems=1 validation
  • SalesTariffEntry.ConsumptionCost: Added minItems=1 validation

Test plan

  • All existing tests pass
  • Updated get_composite_schedule_test.go for new CompositeSchedule structure
  • Updated common_test.go for new validation constraints
  • Updated get_variables_test.go for new maxLength
  • go build ./ocpp2.0.1/... passes
  • go test ./ocpp2.0.1_test/... passes

Related

Complements PR #386 which also addresses CompositeSchedule schema compliance.

Replaces #411

🤖 Generated with Claude Code

andig and others added 12 commits July 30, 2024 08:04
* chore: fix typo

* Update types.go

---------

Co-authored-by: premultiply <4681172+premultiply@users.noreply.github.com>
CRITICAL fixes:
- CompositeSchedule: Redesign struct to match schema (evseId, duration,
  scheduleStart, chargingRateUnit, chargingSchedulePeriod)
- ChargingSchedulePeriod: Add missing phaseToUse field (1-3)
- IdTokenInfo: Add missing evseId array field
- GetVariableResult: Add attributeStatusInfo field
- GetVariableResult: Fix attributeValue maxLength (1000 -> 2500)

HIGH fixes:
- OCSPRequestDataType: Make responderURL required per schema
- ConsumptionCost.Cost: Add minItems=1 validation
- SalesTariffEntry.ConsumptionCost: Add minItems=1 validation

Updates tests to match new validation requirements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@andig andig requested a review from lorenzodonini as a code owner April 16, 2026 13:45
Comment thread ocpp1.6/types/types.go Outdated
Comment thread ocpp1.6/core/get_configuration.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants