Wot-thing-description: What can be a TM is not clearly defined

Created on 16 Feb 2021  路  6Comments  路  Source: w3c/wot-thing-description

Coming from #1049

The current spec allows defining placeholders in TMs and it seems that they can be used everywhere. I think that placeholders should not be used in place of Objects.

The current spec allows the following:

  1. Inside a Data Schema
"type":"object"
"properties":"{{MY_PLACEHOLDER}}"
  1. Root level
{
  "@context": "...",
  "actions":"{{MY_PLACEHOLDER}}",
  "events":"{{MY_PLACEHOLDER_2}}"
}
  1. Even the following is allowed
"{{MY_PLACEHOLDER}}"

Is there any use case to have such generic placeholders? The first case can be simply modeled by omitting the properties key. The second and third cases defeat the meaning of a model since the model on its own doesn't mean anything.

My proposal would be to limit placeholders to replace strings, numbers, integers, booleans which can of course be inside an object or array

Propose closing Thing Model

All 6 comments

Based on the PR option 3 is not allowed. Option 2 would be possible. If there is a mapping file this can be also be taken into account for validation. But I would be ok to introduce limitation that placeholder not allowed to describe interactions. Any comments?

Coming from object oriented programming I can see the point that someone wants to describe the "interface" in a TM.
e.g., saying a TD should have a property status which is of type string.

{
   ...
    "properties": {
        "status": {
            "type": "string",
            "forms": "{{STATUS_FORMS_PLACEHOLDER}}"
        }
    }
    ..
}

The forms array might make use of a placeholder. I think in this case support for arrays would be beneficial....

Based on the PR option 3 is not allowed

I have found this, is the following text the reason it is not allowed?

A Thing Model is recognized by the top level @type. Thing Model definitions MUST use the keyword @type at top level and a value of type string or array that equals or respectively contains ThingModel.

Regarding forms replacement above, wouldn't it be better to simply not put forms? However, I do see a bit of a benefit in making it clear that there will be a placeholder-based replacement and not another mechanism.

@egekorkan not really, its this one:

Placeholder can be only applied within the value of the JSON name-value pair and the value have to be typed as JSON string.

Ah I see @sebastiankb. In that case, that part needs an assertion and should be gray highlighted :)

Ah I see @sebastiankb. In that case, that part needs an assertion and should be gray highlighted :)

done.

I label this issue as proposed closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

egekorkan picture egekorkan  路  8Comments

benfrancis picture benfrancis  路  8Comments

mlagally picture mlagally  路  9Comments

zolkis picture zolkis  路  5Comments

relu91 picture relu91  路  4Comments