Wot-thing-description: jsonschema:StringSchema: pattern missing and maxLength is defined wrongly

Created on 22 Apr 2021  路  10Comments  路  Source: w3c/wot-thing-description

In the jsonschema ontology:

  1. jsonschema:StringSchema doesn't have a pattern property, although this is defined in JSON Schema Spec. -> pattern property should be added // see also #1094
  2. jsonschema:maxLength states in text that it should apply to strings, but the domain is set to numbers and strings -> domain should be corrected to StringSchema

p.s. I logged this here as I couldn't find a separate github repo for the jsonschema ontology after discussion with @sebastiankb

bug PR available JSON Schema

Most helpful comment

Below is the list of terms that are in JSON Schema but not in TD Recommendation ( I explicitly compare with this). I check the ones that are in the latest editors draft:

Any Instance:

  • [ ] default
  • [ ] examples
  • [ ] if
  • [ ] then
  • [ ] else
  • [ ] anyOf
  • [ ] allOf
  • [ ] not

Number/Integer:

  • [x] multipleOf
  • [x] exclusiveMaximum
  • [x] exclusiveMinimum

String:

  • [ ] maxLength
  • [ ] minLength
  • [ ] pattern
  • [ ] contentEncoding
  • [ ] contentMediaType

Arrays:

  • [ ] additionalItems
  • [ ] uniqueItems
  • [ ] contains

Objects:

  • [ ] maxProperties
  • [ ] minProperties
  • [ ] patternProperties
  • [ ] additionalProperties
  • [ ] dependencies
  • [ ] propertyNames

All 10 comments

Although I generally do not oppose to adding JSON Schema terms, what is the use case here? We should always document addition of new features with corresponding use cases/requirements.

Question: Do we really need a use-case and/or requirement for each feature or try to add all of the JSONSchema terms.
I'm not sure, though how much work that would be...

I think, with regards to the origin from existing approaches like JSON Schema, we should not always provide use cases that have probably already been discussed there and are kind of obvious to be reused in TD as well. Here, the simple generic use case would be to allow restrictions on the data model definitions.

Sorry for my late comment. Use case is that we have some string property affordances that need to follow a certain pattern. Specifically these are some date time formats, but with added wildcards, so they cannot be represented with standard formats of JSON schema.

Generally, I think JSON schema ontology should provide whatever the JSON schema spec. is providing, with some exceptions like $ref, as that can be covered with RDF mechanisms already.

In that case, we can simply just add all the JSON Schema terms of draft 7 and don't lose time for discussion and also stopping to confuse people when some terms are there and some are not. I had proposed this in Princeton Plugfest but it was rejected due to lack of need for the terms and having to maintain them all.

I had proposed this in Princeton Plugfest but it was rejected due to lack of need for the terms and having to maintain them all.

Year, that was over 2 years ago and there was a different focus that time. In the meantime, the DataSchema was extended step by step. Now I'm wondering, how the delta look like. @egekorkan Do you have an overview?

Below is the list of terms that are in JSON Schema but not in TD Recommendation ( I explicitly compare with this). I check the ones that are in the latest editors draft:

Any Instance:

  • [ ] default
  • [ ] examples
  • [ ] if
  • [ ] then
  • [ ] else
  • [ ] anyOf
  • [ ] allOf
  • [ ] not

Number/Integer:

  • [x] multipleOf
  • [x] exclusiveMaximum
  • [x] exclusiveMinimum

String:

  • [ ] maxLength
  • [ ] minLength
  • [ ] pattern
  • [ ] contentEncoding
  • [ ] contentMediaType

Arrays:

  • [ ] additionalItems
  • [ ] uniqueItems
  • [ ] contains

Objects:

  • [ ] maxProperties
  • [ ] minProperties
  • [ ] patternProperties
  • [ ] additionalProperties
  • [ ] dependencies
  • [ ] propertyNames

Thanks for the list @egekorkan.

Since this issue was for two minor points in the jsonschema ontology, and the discussion now diverted to the TD specification and got broader, shall we separate these new aspects to a new issue?

@egekorkan I think string has minLength and maxLength already and can be checked also.
see https://w3c.github.io/wot-thing-description/#stringschema

I close this issue since original topic is addressed by #1104.

1119 will further address the JSON Schema alignment topic

Was this page helpful?
0 / 5 - 0 ratings