Skip to content

[consumed-thing] Op values are not filled with defaults in properties #302

Closed
@jak0bw

Description

@jak0bw

When consuming a Thing Description the op values are not properly filled for a property. Example is below.

  1. I consume a simplified version of TestThing with only bool property.
{
    "id": "urn:dev:wot:org:w3:testthing:lyon2018",
    "title": "TestThing",
    "@context": "https://www.w3.org/2019/wot/td/v1",
    "@type": "Thing",
    "security": [
        "nosec_sc"
    ],
    "properties": {
        "bool": {
            "title": "true/false",
            "type": "boolean",
            "readOnly": false,
            "writeOnly": false,
            "observable": false,
            "forms": [
                {
                    "href": "http://plugfest.thingweb.io:8083/TestThing/properties/bool",
                    "contentType": "application/json",
                    "op": [
                        "readproperty",
                        "writeproperty"
                    ]
                }
            ]
        }
    },
    "securityDefinitions": {
        "nosec_sc": {
            "scheme": "nosec"
        }
    }
}

When I do writeProperty() everything works as expected.

  1. When I remove readOnly, writeOnly, observable, they are inserted by default. When I do writeProperty()everything works as expected.
  2. When I remove the whole op array and do writeProperty() everything works as expected. However when I inspect the Thing Description after consumption the op values are not inserted per default.
  3. The real problem is the op insertion. If I remove only writeproperty from the op array, writeProperty() fails.
    The Thing Description that fails is the following:
{
    "id": "urn:dev:wot:org:w3:testthing:lyon2018",
    "title": "TestThing",
    "@context": "https://www.w3.org/2019/wot/td/v1",
    "@type": "Thing",
    "security": [
        "nosec_sc"
    ],
    "properties": {
        "bool": {
            "title": "true/false",
            "type": "boolean",
            "readOnly": false,
            "writeOnly": false,
            "observable": false,
            "forms": [
                {
                    "href": "http://plugfest.thingweb.io:8083/TestThing/properties/bool",
                    "contentType": "application/json",
                    "op": [
                        "readproperty"
                    ]
                }
            ]
        }
    },
    "securityDefinitions": {
        "nosec_sc": {
            "scheme": "nosec"
        }
    }
}

The TD Spec here defines default values for op. I think op should always be generated and in case of missing elements should be filled according to the default value definitions.

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