Skip to content

feat: expand exploreDirectory algorithm #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 47 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,15 @@ <h3>Validating an ExposedThingInit</h3>
optional ThingFilter filter = {});
};
</pre>

<!-- TODO: Improve and integrate into code section above -->
<pre class="idl">
dictionary ExploreDirectoryQuery {
DOMString query;
DOMString queryType;
};
</pre>

<div>
Belongs to the <a>WoT Discovery</a> conformance class. Starts the discovery process that given a <a>TD Directory</a> URL, will provide {{ThingDescription}} objects for <a>Thing Description</a>s that match an optional |filter:ThingFilter| argument of type {{ThingFilter}}. The method MUST run the following steps:
<ol>
Expand All @@ -754,31 +763,51 @@ <h3>Validating an ExposedThingInit</h3>
Set |discovery|.{{ThingDiscoveryProcess/[[filter]]}} to |filter:ThingFilter|.
</li>
<li>
Request the underlying platform to start the directory discovery process.
<p class="note">
This is a placeholder for more details in the discovery algorithm.
Implementations should follow the procedures described in the
[[wot-discovery]] and [wot-binding-templates] specifications.
Some normative steps are indicated below.
Some normative steps (that are currently Work in Progress) are
indicated below.
</p>

If the underlying implementation cannot support the
<a>Protocol Binding</a> indicated by |url|, [=reject=] |promise| with
{{NotSupportedError}} and stop.
</li>
<li>
Request the underlying platform to retrieve the TD available under
|discovery|.{{ThingDiscoveryProcess/[[url]]}}.
If that does not return a valid TDD Thing Description, [=reject=]
|promise| with {{TypeError}} and stop.
<!-- TODO: Define what a valid TDD TD is. -->
Otherwise, let |directoryTd| be the retrieved TD.
</li>
<li>
Let |consumedTddThing| be the result of
<a href="#creating-consumedthing">creating a <dfn>ConsumedThing</dfn></a>
from |directoryTd|.
If that fails, resolve |promise| with {{SyntaxError}} and stop.
</li>
<li>
Run the <a>discovery process</a> given |discovery| by running the
following steps:
<ol>
<!-- TODO: Deal with pagination etc. -->
<li>
If |url| is not a <a>TD Directory</a> or if the underlying
implementation cannot support the <a>Protocol Binding</a>
indicated by |url|, [=reject=] |promise|
with {{NotSupportedError}} and terminate these steps.
</li>
<li>
If filters in general are not supported by the implementation and
|filter| is not `undefined` or `null`, [=reject=] |promise|
with {{NotSupportedError}} and stop.
If the {{ThingDiscoveryProcess/[[filter]]}} argument is not
`undefined` or `null`, let |queryType| be invoke the Action that
represents the corresponding Search API described by
<!-- TODO: Check syntax and field access. -->
{{ThingDiscoveryProcess/[[filter]].queryType}}.
<!--
TODO: Specify a mapping of filter values to search API actions
-->
If the corresponding Action is not present, throw a
{{NotSupportedError}} and stop.
</li>
<li>
Run the <a>discovery process</a> given |discovery|.
<p class="note">
From this point on, errors are recorded only on
{{ThingDiscoveryProcess/error}}, but don't affect |promise| any longer.
</p>
Otherwise, read the `things` property.
</li>
</ol>
</li>
Expand Down Expand Up @@ -3854,7 +3883,8 @@ <h3>The <dfn>ThingFilter</dfn> dictionary</h3>
<pre class="idl">
dictionary ThingFilter {
object? fragment;
<!-- DOMString? query; -->
<!-- TODO: Should this be part of the general "ThingFilter"? -->
ExploreDirectoryQuery? directoryQuery
};
</pre>
<p>
Expand Down