Validation problems when json object uses decimals #2501
Unanswered
luismiguelcelda
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm encountering a validation issue when validating an JSON object with draft-06 version of schema:
Schema:
{ "$schema": "http://json-schema.org/draft-06/schema#", "title": "RemoteStartTransactionRequest", "type": "object", "properties": { "connectorId": { "type": "integer" }, "idTag": { "type": "string", "maxLength": 20 }, "chargingProfile": { "type": "object", "properties": { "chargingProfileId": { "type": "integer" }, "transactionId": { "type": "integer" }, "stackLevel": { "type": "integer" }, "chargingProfilePurpose": { "type": "string", "additionalProperties": false, "enum": [ "ChargePointMaxProfile", "TxDefaultProfile", "TxProfile" ] }, "chargingProfileKind": { "type": "string", "additionalProperties": false, "enum": [ "Absolute", "Recurring", "Relative" ] }, "recurrencyKind": { "type": "string", "additionalProperties": false, "enum": [ "Daily", "Weekly" ] }, "validFrom": { "type": "string", "format": "date-time" }, "validTo": { "type": "string", "format": "date-time" }, "chargingSchedule": { "type": "object", "properties": { "duration": { "type": "integer" }, "startSchedule": { "type": "string", "format": "date-time" }, "chargingRateUnit": { "type": "string", "additionalProperties": false, "enum": [ "A", "W" ] }, "chargingSchedulePeriod": { "type": "array", "items": { "type": "object", "properties": { "startPeriod": { "type": "integer" }, "limit": { "type": "number", "multipleOf": 0.1 }, "numberPhases": { "type": "integer" } }, "additionalProperties": false, "required": [ "startPeriod", "limit" ] } }, "minChargingRate": { "type": "number", "multipleOf": 0.1 } }, "additionalProperties": false, "required": [ "chargingRateUnit", "chargingSchedulePeriod" ] } }, "additionalProperties": false, "required": [ "chargingProfileId", "stackLevel", "chargingProfilePurpose", "chargingProfileKind", "chargingSchedule" ] } }, "additionalProperties": false, "required": [ "idTag" ], "$id": "urn:OCPP:1.6:2019:12:RemoteStartTransactionRequest" }
JSON object to validate:
{ "connectorId": -36350181, "idTag": "et id nisi", "chargingProfile": { "chargingProfileId": 97423894, "transactionId": 5413440, "stackLevel": 56179684, "chargingProfilePurpose": "ChargePointMaxProfile", "chargingProfileKind": "Absolute", "recurrencyKind": "Daily", "validFrom": "1952-03-23T13:27:11.0Z", "validTo": "1969-06-02T18:20:55.0Z", "chargingSchedule": { "startSchedule": "1929-07-17T08:05:06.0Z", "chargingRateUnit": "W", "chargingSchedulePeriod": [ { "startPeriod": -33003912, "limit": -1294569.8, "numberPhases": -80998804 }, { "startPeriod": 32382491, "limit": -1382612.3 } ], "minChargingRate": -37064270.9 } } }
Received error:
{ instancePath: '/chargingProfile/chargingSchedule/chargingSchedulePeriod/0/limit', schemaPath: '#/properties/chargingProfile/properties/chargingSchedule/properties/chargingSchedulePeriod/items/properties/limit/multipleOf', keyword: 'multipleOf', params: { multipleOf: 0.1 }, message: 'must be multiple of 0.1' }
I attempted to validate the same data using multiple online JSON Schema validators, and all of them reported NO errors.
Versions used:
Beta Was this translation helpful? Give feedback.
All reactions