w3c / wot-thing-description

Web of Things (WoT) Thing Description
http://w3c.github.io/wot-thing-description/
Other
131 stars 63 forks source link

Potential error in json schema #1553

Open AndreaCimminoArriaga opened 2 years ago

AndreaCimminoArriaga commented 2 years ago

I'm validating the following TD against the JSON schema provided in the current spec

{
    "@context":  "https://www.w3.org/2019/wot/td/v1",
    "titles": {
        "en": "test1"
    },
    "id": "079637bb-87d5-4fef-9704-d556364d90ba",
    "properties": {
        "KnowledgeGraph": {
            "forms": [
                {
                    "href": "https://data.cogito.linkeddata.es/resources/079637bb-87d5-4fef-9704-d556364d90ba",
                    "type": "text/turtle"
                }
            ]
        }
    },
  "security": [ "nosec_sc" ],
    "securityDefinitions": { "nosec_sc": { "scheme": "nosec" }}
}

The problem is that the key title is mandatory according to the current schema so if a user needs to directly use titles instead, the TD is always incorrect since it lacks of title. Is this behaviour correct? Shouldn't be possible to use either title or titles as equivalent keys since they are just different forms of expressing the same?

relu91 commented 2 years ago

Yes JSON schema is correct. title is mandatory per https://w3c.github.io/wot-thing-description/#thing. Moreover, there are two assertions that regulate and explain the usage of title combined with titles ( td-multilanguage, td-title-description, and td-titles-descriptions). In short title should be used as a default choice per entries inside titles

AndreaCimminoArriaga commented 2 years ago

So in my case, I should write the TD as follows in order to have it valid ?

{
    "@context":  "https://www.w3.org/2019/wot/td/v1",
    "title" : "test1",
    "titles": {
        "en": "test1"
    },
    "id": "079637bb-87d5-4fef-9704-d556364d90ba",
    "properties": {
        "KnowledgeGraph": {
            "forms": [
                {
                    "href": "https://data.cogito.linkeddata.es/resources/079637bb-87d5-4fef-9704-d556364d90ba",
                    "type": "text/turtle"
                }
            ]
        }
    },
  "security": [ "nosec_sc" ],
    "securityDefinitions": { "nosec_sc": { "scheme": "nosec" }}
}
egekorkan commented 2 years ago

So in my case, I should write the TD as follows in order to have it valid ?

{
    "@context":  "https://www.w3.org/2019/wot/td/v1",
    "title" : "test1",
    "titles": {
        "en": "test1"
    },
    "id": "079637bb-87d5-4fef-9704-d556364d90ba",
    "properties": {
        "KnowledgeGraph": {
            "forms": [
                {
                    "href": "https://data.cogito.linkeddata.es/resources/079637bb-87d5-4fef-9704-d556364d90ba",
                    "type": "text/turtle"
                }
            ]
        }
    },
  "security": [ "nosec_sc" ],
    "securityDefinitions": { "nosec_sc": { "scheme": "nosec" }}
}

Yes, that's sadly the case at the moment. You can and should also use the @language tag to indicate the language of human readable fields in the current td. A consumer doesn't necessarily tries to make a match to find the current language.

sebastiankb commented 2 years ago

A topic which should be re-discussed for TD 2.0