Skip to content

Support more than string for Sensor.metadata #2142

@matthijskooijman

Description

@matthijskooijman

Reading the SensorThings 1.1 spec for Sensor, I see:

Field: metadata
Description: The detailed description of the Sensor or system. The metadata type is defined by encodingType.
Datatype: Any (depending on the value of the encodingType)

In my interpretation, this means that the metadata field can contain any valid JSON value. I wanted to put a JSON sensorml description directly in the metadata field as an object (not a string-encoded JSON), which I think the spec should allow:

{
        "name": "Si7021",
        "description": "Si7021 temperature and humidity sensor",
        "encodingType": "application/sml+json",
        "metadata": {
          "type": "PhysicalComponent",
          "name": "temp_humid_sensor",
          "definition": "http://www.w3.org/ns/sosa/System",
          "label": "Si7021 Temperature/Humidity Sensor",
          "identifiers": [
              "definition": "http://sensorml.com/ont/swe/property/ModelNumber",
              "label": "Model Number",
              "value": "Si7021"
            }
          ]
        }
 }

However, it seems FROST requires specifying a string for metadata:

{"code":400,"type":"error","message":"Cannot deserialize value of type  java.lang.String  from Object value (token  JsonToken.START_OBJECT )  at  Source: REDACTED ( StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION  disabled); line: 1, column:"}

"name": "metadata",
"type": "Edm.String",

Am I misinterpreting the spec, or is this just not implemented in FROST. Could it be implemented? It seems this would be similar to how "properties" already works, except that is always an object, and this could also be other JSON types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions