Skip to content

Commit b4537b9

Browse files
authored
Minor changes on chapters 4 and 5 (#231)
* Minor changes on chapters 4 and 5 Introduce @egekorkan review changes specified in the following pdf document: https://github.com/w3c/wot-scripting-api/files/5017322/ScriptingAPI-review-egekorkan.pdf * Revert <dfn> elements and validation algorithm * Update validation algorithm with a default filling step * Update TD validation algorithm Simplify so that we can build more complex steps from this solid ground * Add editor's note in TD validation
1 parent 16a28ee commit b4537b9

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

index.html

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ <h2>The <dfn>ThingDescription</dfn> type</h2>
316316
let res = await fetch('https://tds.mythings.biz/sensor11');
317317
// ... additional checks possible on res.headers
318318
let td = await res.json();
319-
let thing = new ConsumedThing(td);
319+
let thing = await WOT.consume(td);
320320
console.log("Thing name: " + thing.getThingDescription().title);
321321
} catch (err) {
322322
console.log("Fetching TD failed", err.message);
@@ -350,21 +350,13 @@ <h2>The <dfn>ThingDescription</dfn> type</h2>
350350
To <dfn>validate a TD</dfn> given |td:ThingDescription|, run the following steps:
351351
<ol>
352352
<li>
353-
If |td| is not an object, [= exception/throw =] a
354-
{{"TypeError"}} and abort these steps.
355-
</li>
356-
<li>
357-
If any of the mandatory properties defined in [[!WOT-TD]] for
358-
<a href="https://www.w3.org/TR/2019/CR-wot-thing-description-20190516/#thing">Thing</a>
359-
that don't have <a href="https://www.w3.org/TR/2019/CR-wot-thing-description-20190516/#sec-default-values">default definitions</a>
360-
are missing from |td|, [= exception/throw =] a
361-
{{"TypeError"}} and abort these steps.
362-
</li>
363-
<li>
364-
If <a href="https://www.w3.org/TR/2019/CR-wot-thing-description-20190516/#json-schema-for-validation">JSON schema validation</a> fails on |td|, [= exception/throw =] a
365-
{{"TypeError"}} and abort these steps.
353+
If <a href="https://www.w3.org/TR/2019/CR-wot-thing-description-20190516/#json-schema-for-validation">JSON schema
354+
validation</a> fails on |td|, [= exception/throw =] a {{"TypeError"}} and abort these steps.
366355
</li>
367356
</ol>
357+
<p class="ednote" title="Handling default values">
358+
Additional steps may be added to fill the default values of mandatory fields.
359+
</p>
368360
</div>
369361
</section>
370362
</section>

0 commit comments

Comments
 (0)