opengeospatial / sensorthings

The official web site of the OGC SensorThings API standard specification.
132 stars 28 forks source link

Clarification on HTTP PATCH with inline entities #89

Open mjacoby opened 4 years ago

mjacoby commented 4 years ago

I came across an issue with HTTP PATCH requests containing inline entities and what is the expected behavior according to the standard. Image the following scenario:

Preconditions

HTTP PATCH .../Things(3)

{
    "Locations": [
        {
            "@iot.id": 2,
            "name": "new location name"
        }
    ]
}

What is expected result here? According to

The entity SHALL NOT contain related entities as inline content. It MAY contain binding information for navigation properties. For single-valued navigation properties this replaces the relationship. For collection-valued navigation properties this adds to the relationship. http://docs.opengeospatial.org/is/15-078r6/15-078r6.html#66

and (from the test suite section)

For each SensorThings entity type send an update request with PATCH that contains related entities as inline content, check if the service fails the request and returns appropriate HTTP status code. http://docs.opengeospatial.org/is/15-078r6/15-078r6.html#97

I would assume that this should fail (although I was not able to find the expected status code).

According to the first quote I assume that something like this should however work

HTTP PATCH .../Things(3)

{
    "Locations": [
        {
            "@iot.id": 2
        }
    ]
}

Are my assumptions on this correct? If so, would it be correct to say that inline entities are only allowed in HTTP PATCH if they contain exactly one property which is @iot.id ?

hylkevds commented 4 years ago

Looks good to me. I like the addition of examples.