Skip to content

Invalid structure of type CompositeSchedule (v2.0.1) #385

@sderkacs

Description

@sderkacs

The current v2.0.1 CompositeSchedule type has the following structure:

type CompositeSchedule struct {
	StartDateTime    *types.DateTime         `json:"startDateTime,omitempty" validate:"omitempty"`
	ChargingSchedule *types.ChargingSchedule `json:"chargingSchedule,omitempty" validate:"omitempty"`
}

However, the JSON schema is completely different:

"CompositeScheduleType": {
  "description": "Composite_ Schedule\r\nurn:x-oca:ocpp:uid:2:233362\r\n",
  "javaType": "CompositeSchedule",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "customData": {
      "$ref": "#/definitions/CustomDataType"
    },
    "chargingSchedulePeriod": {
      "type": "array",
      "additionalItems": false,
      "items": {
        "$ref": "#/definitions/ChargingSchedulePeriodType"
      },
      "minItems": 1
    },
    "evseId": {
      "description": "The ID of the EVSE for which the\r\nschedule is requested. When evseid=0, the\r\nCharging Station calculated the expected\r\nconsumption for the grid connection.\r\n",
      "type": "integer"
    },
    "duration": {
      "description": "Duration of the schedule in seconds.\r\n",
      "type": "integer"
    },
    "scheduleStart": {
      "description": "Composite_ Schedule. Start. Date_ Time\r\nurn:x-oca:ocpp:uid:1:569456\r\nDate and time at which the schedule becomes active. All time measurements within the schedule are relative to this timestamp.\r\n",
      "type": "string",
      "format": "date-time"
    },
    "chargingRateUnit": {
      "$ref": "#/definitions/ChargingRateUnitEnumType"
    }
  },
  "required": [
    "evseId",
    "duration",
    "scheduleStart",
    "chargingRateUnit",
    "chargingSchedulePeriod"
  ]
}

Expected type structure (excluding CustomData) is:

type CompositeSchedule struct {
	ChargingSchedulePeriod []types.ChargingSchedulePeriod `json:"chargingSchedulePeriod" validate:"required,min=1"`
	EvseID                 int                            `json:"evseId" validate:"required,gte=0"`
	Duration               int                            `json:"duration" validate:"required,gte=0"`
	ScheduleStart          types.DateTime                 `json:"scheduleStart" validate:"required"`
	ChargingRateUnit       types.ChargingRateUnitType     `json:"chargingRateUnit" validate:"required,chargingRateUnit201"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions