Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
888bf5e
chore: fix typo in hctl.ttl file (reponse -> response)
JKRhb Feb 14, 2025
ae37f23
feat!: make contentType optional in ExpectedResponse class
JKRhb Feb 14, 2025
a04b3b7
chore: regenerate
JKRhb Feb 14, 2025
005463d
feat!: remove default contentType of AdditionalExpectedResponse
JKRhb Feb 14, 2025
2bdf242
fixup! chore: regenerate
JKRhb Feb 14, 2025
8f1630e
feat!: adjust assertions for (Additional)ExpectedResponse
JKRhb Feb 17, 2025
3ba3b20
fixup! chore: regenerate
JKRhb Feb 17, 2025
d6978ef
fixup! feat!: adjust assertions for (Additional)ExpectedResponse
JKRhb Feb 17, 2025
12c10ee
fixup! chore: regenerate
JKRhb Feb 17, 2025
288489e
fixup! feat!: adjust assertions for (Additional)ExpectedResponse
JKRhb Mar 5, 2025
d6de912
fixup! chore: regenerate
JKRhb Mar 5, 2025
16bf677
fixup! chore: regenerate
JKRhb Aug 6, 2025
5aa16c6
fixup! feat!: adjust assertions for (Additional)ExpectedResponse
JKRhb Aug 6, 2025
c803bb3
fixup! chore: regenerate
JKRhb Aug 6, 2025
aa03e97
fixup! chore: regenerate
JKRhb Aug 6, 2025
fcd3ccc
feat!: remove application/json as default form contentType
JKRhb Aug 6, 2025
69bf17d
fixup! chore: regenerate
JKRhb Aug 6, 2025
d2df592
feat!: adjust examples not not assume application/json as default
JKRhb Aug 6, 2025
48d6a2e
fixup! chore: regenerate
JKRhb Aug 6, 2025
48dc58c
Further adjust assertions for the ExpectedResponse class
JKRhb Aug 21, 2025
a59a068
Regenerate
JKRhb Aug 21, 2025
d7ed300
Partially revert changes to the original expectedResponse assertion
JKRhb Aug 21, 2025
2f822bd
Regenerate
JKRhb Aug 21, 2025
9ec6c7a
Remove unneeded/obsolete ExpectedResponse assertions
JKRhb Aug 21, 2025
22c2eed
Add example on empty response payloads
JKRhb Aug 21, 2025
87e2f27
Regenerate
JKRhb Aug 21, 2025
d007684
Remove default form content type from "omission example" again
JKRhb Aug 21, 2025
d710600
Regenerate
JKRhb Aug 21, 2025
f4e13b7
Add missing comma to example
JKRhb Aug 21, 2025
beeb7c3
Regenerate
JKRhb Aug 21, 2025
8b0a67a
Apply suggestions from code review
JKRhb Aug 24, 2025
84f54b7
Adjust style of Consumer definition
JKRhb Aug 24, 2025
89936e3
Regenerate
JKRhb Aug 24, 2025
4349d0f
Improve additionalResponses assertions and formatting
JKRhb Aug 24, 2025
ab8c048
Regenerate
JKRhb Aug 24, 2025
951a61e
Add input to action example without response payload
JKRhb Aug 24, 2025
f493c80
Expand additionalResponses example with no-payload case
JKRhb Aug 24, 2025
72efc20
Add assertion to additionalResponses that demands a contentType for s…
JKRhb Aug 24, 2025
2eb1403
Simplify formatting
JKRhb Aug 24, 2025
d82890d
Regenerate
JKRhb Aug 24, 2025
d369fef
Use "can [...] only" instead of "may only"
JKRhb Aug 26, 2025
c6ced0b
Regenerate
JKRhb Aug 26, 2025
bd96988
testing: update assertions
egekorkan Aug 27, 2025
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
115 changes: 60 additions & 55 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3685,7 +3685,7 @@ <h3><code>Form</code></h3>
></cite
>].
</td>
<td><a href="#sec-default-values">with default</a></td>
<td>optional</td>
<td>
<a href="https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#string"><code>string</code></a>
</td>
Expand Down Expand Up @@ -4068,7 +4068,7 @@ <h4>Response-related Terms Usage</h4>

<p>
The optional <code>response</code> name-value pair can be used to provide metadata for the expected
response message. With the core vocabulary, it only includes content type information, but TD Context
response message. With the core vocabulary, it may only include content type information, but TD Context
Extensions could be applied.
<span class="rfc2119-assertion" id="td-expectedResponse-default-contentType"
>If no <code>response</code> name-value pair is provided, it MUST be assumed that the content type of
Expand All @@ -4077,9 +4077,7 @@ <h4>Response-related Terms Usage</h4>
Note that <code>contentType</code> within an
<code>ExpectedResponse</code>
<a href="#dfn-class" class="internalDFN" data-link-type="dfn">Class</a> does not have a
<a href="#dfn-default-value" class="internalDFN" data-link-type="dfn">Default Value</a>. For instance,
if the value of the content type of the form is <code>application/xml</code> the assumed value of the
content type of the response will be also <code>application/xml</code>.
<a href="#dfn-default-value" class="internalDFN" data-link-type="dfn">Default Value</a>.
</p>
<p>
In some cases additional responses might be possible. One example of this is error responses but in some
Expand All @@ -4094,28 +4092,26 @@ <h4>Response-related Terms Usage</h4>
<p>
In some use cases, input and output data might be represented in a different form, for instance an
Action that accepts JSON, but returns an image. In such a case, the optional
<code>response</code> name-value pair can describe the content type of the expected response.
<span class="rfc2119-assertion" id="td-expectedResponse-contentType"
>If the content type of the expected response differs from the content type of the form, the
<code>Form</code> instance <em class="rfc2119" title="MUST">MUST</em> include a name-value pair with
the name <code>response</code>.</span
>
For instance, an <code>ActionAffordance</code> could only accept <code>application/json</code> for its
input data, while it will respond with an <code>image/jpeg</code> content type for its output data. In
that case the content types differ and the <code>response</code>
name-value pair has to be used to provide response content type (<code>image/jpeg</code>) information to
the
<a href="#dfn-consumer" class="internalDFN" data-link-type="dfn">Consumer</a>.
<code>response</code> name-value pair can describe the content type of the expected response. As there
is no default value defined,
<span class="rfc2119-assertion" id="td-expectedResponse-missing-contentType">
the lack of a <code>contentType</code> value in a <code>response</code> object within a form implies
that the response <em class="rfc2119" title="MUST NOT">MUST NOT</em> contain any payload.
</span>
<span class="rfc2119-assertion" id="td-expectedResponse-defined-contentType">
If a content type is defined in the <code>response</code> object within a form, a
<a href="#dfn-consumer" class="internalDFN" data-link-type="dfn"> Consumer </a>
MUST expect a response containing a payload in the respective format, e.g., an image in the case of
<code>image/jpeg</code>.
</span>
</p>
<p>
Similar considerations apply to additional responses, although in this case the
<code>contentType</code> is optional if it is the same as the input content Type (e.g. JSON).
Similar considerations apply to additional responses.
<span class="rfc2119-assertion" id="td-additionalExpectedResponse-contentType"
>If the content type of an additional expected response differs from the content type of the form, the
<code>Form</code> instance <em class="rfc2119" title="MUST">MUST</em> include an entry in the array
associated with the name <code>additionalResponses</code> that includes a value for the name
<code>contentType</code>.</span
>
associated with the name <code>additionalResponses</code>.
</span>
<span class="rfc2119-assertion" id="td-additionalExpectedResponse-schema"
>If the data schema of an additional expected response differs from the output data schema of the
interaction, the <code>Form</code> instance <em class="rfc2119" title="MUST">MUST</em> include an
Expand Down Expand Up @@ -4159,7 +4155,7 @@ <h3><code>ExpectedResponse</code></h3>
></cite
>].
</td>
<td>mandatory</td>
<td>optional</td>
<td>
<a href="https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#string"><code>string</code></a>
</td>
Expand Down Expand Up @@ -4191,6 +4187,18 @@ <h3><code>AdditionalExpectedResponse</code></h3>
<a href="https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#boolean"><code>boolean</code></a>
</td>
</tr>
<tr class="rfc2119-table-assertion" id="td-vocab-schema--AdditionalExpectedResponse">
<td><code>schema</code></td>
<td>
Used to define the output data schema for an additional response if it differs from the default
output data schema. Rather than a <code>DataSchema</code> object, the name of a previous definition
given in a <code>schemaDefinitions</code> map must be used.
</td>
<td>optional</td>
<td>
<a href="https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#string"><code>string</code></a>
</td>
</tr>
<tr class="rfc2119-table-assertion" id="td-vocab-contentType--AdditionalExpectedResponse">
<td><code>contentType</code></td>
<td>
Expand All @@ -4205,18 +4213,6 @@ <h3><code>AdditionalExpectedResponse</code></h3>
></cite
>].
</td>
<td><a href="#sec-default-values">with default</a></td>
<td>
<a href="https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#string"><code>string</code></a>
</td>
</tr>
<tr class="rfc2119-table-assertion" id="td-vocab-schema--AdditionalExpectedResponse">
<td><code>schema</code></td>
<td>
Used to define the output data schema for an additional response if it differs from the default
output data schema. Rather than a <code>DataSchema</code> object, the name of a previous definition
given in a <code>schemaDefinitions</code> map must be used.
</td>
<td>optional</td>
<td>
<a href="https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#string"><code>string</code></a>
Expand Down Expand Up @@ -4305,12 +4301,6 @@ <h3>Default Value Definitions</h3>
<td><code>false</code></td>
<td></td>
</tr>
<tr class="rfc2119-default-assertion" id="td-default-AdditionalResponseContentType">
<td><code>AdditionalExpectedResponse</code></td>
<td><code>contentType</code></td>
<td>value of the <code>contentType</code> of the <code>Form</code> element it belongs to.</td>
<td></td>
</tr>
<tr class="rfc2119-default-assertion" id="td-default-contentType">
<td><code>Form</code></td>
<td><code>contentType</code></td>
Expand Down Expand Up @@ -4563,14 +4553,16 @@ <h2>Omitting Default Values</h2>
"status": {
"type": "string",
"forms": [{
"href": "https://mylamp.example.com/status"
"href": "https://mylamp.example.com/status",
"contentType": "application/json"
}]
}
},
"actions": {
"toggle": {
"forms": [{
"href": "https://mylamp.example.com/toggle"
"href": "https://mylamp.example.com/toggle",
"contentType": "application/json"
}]
}
},
Expand All @@ -4581,6 +4573,7 @@ <h2>Omitting Default Values</h2>
},
"forms": [{
"href": "https://mylamp.example.com/oh",
"contentType": "application/json",
"subprotocol": "longpoll"
}]
}
Expand Down Expand Up @@ -6194,18 +6187,6 @@ <h3><code>response</code></h3>
no <code>output</code> schema is required, as the content type fully specifies the representation format.
</p>

<p>
<span class="rfc2119-assertion" id="td-form-response-object">
If present, the value assigned to <code>response</code> in an instance of <code>Form</code> MUST be a
JSON object.
</span>
<span class="rfc2119-assertion" id="td-forms-response">
If present, the response object MUST contain a <code>contentType</code> member as defined in the
<a>Class</a> definition of <a href="#expectedresponse" class="sec-ref"><code>ExpectedResponse</code></a
>.
</span>
</p>

<p>
A <code>form</code> snippet with the <code>response</code> member is shown below based on the
<code>takePhoto</code> Action described above:
Expand All @@ -6229,6 +6210,30 @@ <h3><code>response</code></h3>
},
// ...
}
</pre
>

<p>
In cases where responses are not expected to contain a payload and therefore no `contentType` as well, an
empty `response` object can be used to convey this information.
</p>
<pre class="example">
{
// ...
"actions": {
"brewCoffee": {
"describe": "Invoking this action does not return a payload.",
// ...
"forms": [{
"op": "invokeaction",
"href": "http://coffee-maker.example.com/brew-coffee",
"contentType": "application/json",
"response": {}
}]
}
},
// ...
}
</pre
>
</section>
Expand Down
49 changes: 29 additions & 20 deletions index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -1310,12 +1310,6 @@ <h3>Default Value Definitions</h3>
<td><code>false</code></td>
<td></td>
</tr>
<tr class="rfc2119-default-assertion" id="td-default-AdditionalResponseContentType">
<td><code>AdditionalExpectedResponse</code></td>
<td><code>contentType</code></td>
<td>value of the <code>contentType</code> of the <code>Form</code> element it belongs to.</td>
<td></td>
</tr>
<tr class="rfc2119-default-assertion" id="td-default-contentType">
<td><code>Form</code></td>
<td><code>contentType</code></td>
Expand Down Expand Up @@ -1568,14 +1562,16 @@ <h2>Omitting Default Values</h2>
"status": {
"type": "string",
"forms": [{
"href": "https://mylamp.example.com/status"
"href": "https://mylamp.example.com/status",
"contentType": "application/json"
}]
}
},
"actions": {
"toggle": {
"forms": [{
"href": "https://mylamp.example.com/toggle"
"href": "https://mylamp.example.com/toggle",
"contentType": "application/json"
}]
}
},
Expand All @@ -1586,6 +1582,7 @@ <h2>Omitting Default Values</h2>
},
"forms": [{
"href": "https://mylamp.example.com/oh",
"contentType": "application/json",
"subprotocol": "longpoll"
}]
}
Expand Down Expand Up @@ -3199,18 +3196,6 @@ <h3><code>response</code></h3>
no <code>output</code> schema is required, as the content type fully specifies the representation format.
</p>

<p>
<span class="rfc2119-assertion" id="td-form-response-object">
If present, the value assigned to <code>response</code> in an instance of <code>Form</code> MUST be a
JSON object.
</span>
<span class="rfc2119-assertion" id="td-forms-response">
If present, the response object MUST contain a <code>contentType</code> member as defined in the
<a>Class</a> definition of <a href="#expectedresponse" class="sec-ref"><code>ExpectedResponse</code></a
>.
</span>
</p>

<p>
A <code>form</code> snippet with the <code>response</code> member is shown below based on the
<code>takePhoto</code> Action described above:
Expand All @@ -3234,6 +3219,30 @@ <h3><code>response</code></h3>
},
// ...
}
</pre
>

<p>
In cases where responses are not expected to contain a payload and therefore no `contentType` as well, an
empty `response` object can be used to convey this information.
</p>
<pre class="example">
{
// ...
"actions": {
"brewCoffee": {
"describe": "Invoking this action does not return a payload.",
// ...
"forms": [{
"op": "invokeaction",
"href": "http://coffee-maker.example.com/brew-coffee",
"contentType": "application/json",
"response": {}
}]
}
},
// ...
}
</pre
>
</section>
Expand Down
2 changes: 1 addition & 1 deletion ontology/hctl.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h2>Terminology</h2>
<code>schemaDefinitions</code> map must be used.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#AdditionalExpectedResponse">hctl:AdditionalExpectedResponse</a></code></td></tr></tbody></table></section>
<section id="hasOperationType"><h4>hasOperationType</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#hasOperationType</code></p><span>Indicates the semantic intention of performing the operation(s) described by the form.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr></tbody></table></section>
<section id="returns"><h4>returns</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#returns</code></p><span>This optional term can be used if, e.g., the output communication metadata differ from input metadata (e.g., output contentType differ from the
input contentType). The response name contains metadata that is only valid for the reponse messages.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="#ExpectedResponse">hctl:ExpectedResponse</a></code></td></tr></tbody></table></section></section><section><h3>Datatype Properties</h3><section id="forContentCoding"><h4>forContentCoding</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#forContentCoding</code></p><span>Content coding values indicate an encoding transformation that has been or can be applied to a representation. Content codings are primarily used to allow a representation to be compressed or otherwise usefully transformed without losing the identity of its underlying media type and without loss of information. Examples of content coding include "gzip", "deflate", etc. </span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Text">schema:Text</a></code></td></tr></tbody></table></section>
input contentType). The response name contains metadata that is only valid for the response messages.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="#ExpectedResponse">hctl:ExpectedResponse</a></code></td></tr></tbody></table></section></section><section><h3>Datatype Properties</h3><section id="forContentCoding"><h4>forContentCoding</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#forContentCoding</code></p><span>Content coding values indicate an encoding transformation that has been or can be applied to a representation. Content codings are primarily used to allow a representation to be compressed or otherwise usefully transformed without losing the identity of its underlying media type and without loss of information. Examples of content coding include "gzip", "deflate", etc. </span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Text">schema:Text</a></code></td></tr></tbody></table></section>
<section id="forContentType"><h4>forContentType</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#forContentType</code></p><span>Assign a content type based on a media type [[IANA-MEDIA-TYPES]] (e.g., 'text/plain') and potential parameters (e.g., 'charset=utf-8') for the media type.</span><table class="def numbered"><tbody><tr><td>Domain includes</td><td><code><a href="#Form">hctl:Form</a></code></td></tr><tr><td>Range includes</td><td><code><a href="http://schema.org/Text">schema:Text</a></code></td></tr></tbody></table></section>
<section id="forSubProtocol"><h4>forSubProtocol</h4><p>IRI: <code>https://www.w3.org/2019/wot/hypermedia#forSubProtocol</code></p><span>Indicates the exact mechanism by which an interaction will be accomplished for a given protocol when there are multiple options.

Expand Down
2 changes: 1 addition & 1 deletion ontology/hctl.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For example, for HTTP and Events, it indicates which of several available mechan
:returns rdf:type owl:ObjectProperty ;
rdfs:label "returns" ;
rdfs:comment """This optional term can be used if, e.g., the output communication metadata differ from input metadata (e.g., output contentType differ from the
input contentType). The response name contains metadata that is only valid for the reponse messages."""@en ;
input contentType). The response name contains metadata that is only valid for the response messages."""@en ;
schema:domainIncludes :Form ;
schema:rangeIncludes :ExpectedResponse .

Expand Down
3 changes: 1 addition & 2 deletions validation/td-json-schema-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@
"contentType": {
"type": "string"
}
},
"required": ["contentType"]
}
},
"form_element_base": {
"type": "object",
Expand Down
Loading
Loading