w3c / w3c/wot-scripting-api

Check data schema algorithm and strings

Open
#240 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug for next iteration validation
Dominant language
HTML
Stars
45
Forks
21
PR merge metrics
No merged PRs in 30d

Description

This issue is derived from my review in #239. I saw that the check data schema algorithm does not perform any check if that DataSchema is equal to string. In principle, I can understand why: any value in JS can be represented in a string. However, I wonder if a more strict check may make life easier for application developers.

Following, the algorithm a property with string data schema can even return something like the following:

{
   "name":"Jhon",
   // .... other properties
}

Consequently, WoT developers should inspect beforehand if that property was mistakenly represented as a string while is actually an object. If we strictly check the type in the check data schema algorithm we mitigate this type of errors, while also maintaining the ability to return an object serialized as a string:

"{ 'name':'Jhon', // .... other properties }"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the check data schema algorithm and the related discussion in issue #239. Define behavior for a string schema so non-string values such as objects are rejected while serialized object strings remain accepted; done should include an agreed algorithm and corresponding validation coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.