STAC - Collection data structure question

I am using pystac to query the Catalog API and have come across a problem. I can retrieve the Catalog . I then attempt to walk over the children of above. When I do this, I get a response from the API, but the parsing of this by pystac fails due to a problem with the interval value, which is as shown below:


Looking at the STAC API reference, it appears that the interval value should always be an array of arrays, even if the top array only contains a single sub-array: stac-spec/ at master · radiantearth/stac-spec · GitHub

The example given at the above page (notice the outer array):

[["2019-01-01T00:00:00Z", null]]

Thus is appears to me that the result being returned from sentinel hub is not STAC compliant due to the time interval not being wrapped in an outer array.

I can patch pystac for now for my own purposes, but would be good to get clarification on whether the result returned from the API is as expected, or not? Could this be an API version issue?

Here’s my patch to in pystac to handle this:

def from_dict(d):
“”"Constructs an TemporalExtent from a dict.

        TemporalExtent: The TemporalExtent deserialized from the JSON dict.
    # Fix for Sentinel Hub non-compliance of Collection temporal interval JSON value
    patch = False
    if(type(d['interval'][0])) == str:
        patch = True
    parsed_intervals = []
    if(patch == False):
        # Original code
        for i in d['interval']:
            start = None
            end = None
            if i[0]:
                start = dateutil.parser.parse(i[0])
            if i[1]:
                end = dateutil.parser.parse(i[1])
            parsed_intervals.append([start, end])
        # Fix for non-compliant result from Sentinel Hub
        start = None
        end = None
        if d['interval'][0]:
            start = dateutil.parser.parse(d['interval'][0])
        if d['interval'][1]:
            end = dateutil.parser.parse(d['interval'][1])
        parsed_intervals.append([start, end])

    return TemporalExtent(intervals=parsed_intervals)