JSON Schema date-time format validation issue

JSON Schema date-time format validation issue

peaksystems
Shopify Partner
1 0 0

Hello. 

 

I am trying to update custom data on an Order through the GraphQL API. The purpose is for our fulfillment service to supply the picked serial numbers on an order.

I have set up a JSON Schema that looks like this:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "array",
    "items": [
        {
            "type": "object",
            "properties": {
                "parcelNumber": {
                    "type": "string"
                },
                "packingTime": {
                    "type": "string",
                    "format": "date-time"
                },
                "lineItems": {
                    "type": "array",
                    "items": [
                        {
                            "type": "object",
                            "properties": {
                                "lineItemId": {
                                    "type": "string"
                                },
                                "itemNumber": {
                                    "type": "string"
                                },
                                "serialNumber": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "lineItemId",
                                "itemNumber",
                                "serialNumber"
                            ]
                        }
                    ]
                }
            },
            "required": [
                "parcelNumber",
                "packingTime",
                "lineItems"
            ]
        }
    ]
}

And I am sending data that looks like this:

[
    {
        "parcelNumber": "n/a",
        "packingTime": "2024-11-19T15:47:17.1562611",
        "lineItems": [
            {
                "lineItemId": "33882713292959",
                "itemNumber": "LEGO-S4561",
                "serialNumber": "8888"
            }
        ]
    }
]



My problem is that the date-time format is failing validation. However, the data I am sending should pass the date-time format validation. 
If look here: 
JSON Schema - string 
RFC 3339 - Date and Time on the Internet: Timestamps

There should be support for the format I am supplying. 

I have validated it using NewtonSoft, which should tell you that the format is right. Check it out here: JSON Schema Validator - Newtonsoft

So my concern is that you are not correctly validating the date-time format in the JSON Schema.

Thanks

Søren

Replies 0 (0)