Skip to content

fix: align CompositeSchedule struct with OCPP 2.0.1 spec#411

Open
rishabhvaish wants to merge 1 commit intolorenzodonini:masterfrom
rishabhvaish:fix/composite-schedule-struct-385
Open

fix: align CompositeSchedule struct with OCPP 2.0.1 spec#411
rishabhvaish wants to merge 1 commit intolorenzodonini:masterfrom
rishabhvaish:fix/composite-schedule-struct-385

Conversation

@rishabhvaish
Copy link
Copy Markdown

The CompositeSchedule struct was wrong — it had StartDateTime and ChargingSchedule fields, but the OCPP 2.0.1 JSON schema for CompositeScheduleType actually defines a flat structure with evseId, duration, scheduleStart, chargingRateUnit, and chargingSchedulePeriod as required fields.

I've fixed the struct to match the spec exactly and added a NewCompositeSchedule constructor for convenience. The validation and E2E tests are updated accordingly, with new negative test cases for missing required fields.

Note: this is a breaking change since the struct fields are completely different. Code using CompositeSchedule{StartDateTime: ..., ChargingSchedule: ...} will need to switch to the new fields.

Fixes #385

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works

The CompositeScheduleType had incorrect fields (StartDateTime +
ChargingSchedule) that didn't match the official OCPP 2.0.1 JSON
schema. Replaced with the five required fields: EvseID, Duration,
ScheduleStart, ChargingRateUnit, and ChargingSchedulePeriod.

Added NewCompositeSchedule constructor and updated tests to validate
the corrected structure including negative cases for missing required
fields.

Fixes lorenzodonini#385
@xBlaz3kx
Copy link
Copy Markdown
Contributor

Duplicate of #386

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.

Invalid structure of type CompositeSchedule (v2.0.1)

2 participants