Skip to content

Commit

Permalink
Add JSON Schema of extensions, TD minimal validation reference (#373)
Browse files Browse the repository at this point in the history
* Add TD extensions' JSON Schema, reference TD Minimal validation

* Fix TD model import

* Change TD JSON Schema to v1.1

* Remove Issue 99 note

* Update index.html

* Update index.html

update minimal validation assertion

Co-authored-by: Michael McCool <michael.mccool@intel.com>
  • Loading branch information
farshidtz and mmccool authored Jul 11, 2022
1 parent 3b71946 commit 8c50e8f
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ <h4>Creation</h4>
Creation refers to the registration of a new <a>TD</a> inside the directory.
</p>
<p>
The TD object is validated in accordance with [[[#validation]]].
The TD object is validated in accordance with [[[#exploration-directory-api-things-validation]]].
Note that a TD may or may not be generated by the <a>Thing</a> it describes.
For brownfield devices in particular a separate <a>Discoverer</a> process
or service may be required that generates and registers a TD for a <a>Thing</a>
Expand All @@ -1540,7 +1540,7 @@ <h4>Creation</h4>
<span class="rfc2119-assertion" id="tdd-things-create-known-contenttype">
The request SHOULD contain `application/td+json` Content-Type header for
JSON serialization of TD.</span>
The TD object is validated in accordance with [[[#validation]]].
The TD object is validated in accordance with [[[#exploration-directory-api-things-validation]]].
<span class="rfc2119-assertion" id="tdd-things-create-known-td-resp">
Upon successful processing, the server MUST respond with
201 (Created) status.</span>
Expand All @@ -1562,7 +1562,7 @@ <h4>Creation</h4>
<span class="rfc2119-assertion" id="tdd-things-create-anonymous-contenttype">
The request SHOULD contain `application/td+json` Content-Type header for
JSON serialization of TD.</span>
The TD object is validated in accordance with [[[#validation]]].
The TD object is validated in accordance with [[[#exploration-directory-api-things-validation]]].
<span class="rfc2119-assertion" id="tdd-things-create-anonymous-td-resp">
Upon successful processing, the server MUST respond with 201 (Created) status
and a Location header containing a system-generated identifier for the TD.</span>
Expand Down Expand Up @@ -1720,7 +1720,7 @@ <h4>Update</h4>
<span class="rfc2119-assertion" id="tdd-things-update-contenttype">
The request SHOULD contain `application/td+json` Content-Type header for JSON
serialization of TD.</span>
The TD object is validated in accordance with [[[#validation]]].
The TD object is validated in accordance with [[[#exploration-directory-api-things-validation]]].
<span class="rfc2119-assertion" id="tdd-things-update-resp">
Upon success, the server MUST respond with 204 (No Content) status.</span>

Expand Down Expand Up @@ -1764,7 +1764,7 @@ <h4>Update</h4>
but appear in the original TD, that member is removed.
Members with object values are processed recursively.

After applying the modifications, the TD object is validated in accordance with [[[#validation]]].
After applying the modifications, the TD object is validated in accordance with [[[#exploration-directory-api-things-validation]]].
<span class="rfc2119-assertion" id="tdd-things-update-partial-resp">
Upon success, the server MUST respond with a 204 (No Content) status.</span>

Expand Down Expand Up @@ -2034,16 +2034,22 @@ <h4>Listing</h4>

</section>

<section id="validation" class="normative">
<section id="exploration-directory-api-things-validation" class="normative">
<h4>Validation</h4>
<p>
<span class="rfc2119-assertion" id="tdd-validation-syntactic">
The syntactic validation of TD objects before storage is RECOMMENDED to
prevent common erroneous submissions.</span>

<span class="rfc2119-assertion" id="tdd-validation-jsonschema">
The server MAY use
<a href="https://www.w3.org/TR/wot-thing-description/#json-schema-for-validation">Thing Description JSON Schema</a>
to validate standard TD vocabulary, or a more comprehensive JSON Schema to also validate extensions.</span>
The server SHOULD use at least
<a href="https://www.w3.org/TR/wot-thing-description11/#minimal-validation-serialization-json">Minimal Validation</a>
as defined in [[wot-thing-description11]]
to validate TDs, including use of the
<a href="https://www.w3.org/TR/wot-thing-description/#json-schema-for-validation">WoT Thing Description (1.0) JSON Schema</a> or
<a href="https://www.w3.org/TR/wot-thing-description11/#json-schema-for-validation">WoT Thing Description 1.1 JSON Schema</a>,
and the JSON schema defined in [[[#tdd-extensions-jsonschema]]] for <a>Enriched TDs</a>,
as appropriate based on the value of the <code>@context</code>.</span>
</p>
<p>
Additional forms of validation can be added to support various use cases.
Expand Down Expand Up @@ -2095,10 +2101,6 @@ <h4>Validation</h4>
</p>
-->
</aside>



<div class="issue" data-number="99"></div>
</section>

</section>
Expand Down Expand Up @@ -2407,9 +2409,8 @@ <h4>API Specification (Thing Model)</h1>
given in this Thing Model
are not normative and are provided for information only.
</p>
<pre class="advisement json">
<div data-include='directory.tm.json'></div>
</pre>
<pre class="advisement json"
data-include='directory.tm.json'></pre>

<!-- Defer
<p class="issue" data-number="82">
Expand Down Expand Up @@ -2972,6 +2973,15 @@ <h2>CoRE Resource Types Registration</h2>

</section>
</section>

<section id="tdd-extensions-jsonschema" class="appendix">
<h1>JSON Schema for WoT Discovery TD-extensions</h1>
The following JSON Schema specifies the extensions used in <a>Enriched TDs</a>.
It can be used for validating <a>TDs</a> by a <a>TDD</a>
as prescribed in [[[#exploration-directory-api-things-validation]]].
<pre class="advisement json"
data-include='validation/td-discovery-extensions-json-schema.json'></pre>
</section>

<section id="changes" class="appendix">
<h1>Recent Specification Changes</h1>
Expand Down

0 comments on commit 8c50e8f

Please sign in to comment.