@@ -992,6 +992,17 @@ <h2>The <dfn>InteractionOutput</dfn> interface</h2>
992992 [=Resolve=] |promise| with < a > [[\value]]</ a > .
993993 </ li >
994994 </ ol >
995+ < p >
996+ While the {{value()}} function provides built-in validation, we recognize that some
997+ use cases may require returning values without validation. In such cases, developers
998+ can use alternative patterns, such as directly accessing the underlying data
999+ using streams or the {{InteractionOutput/arrayBuffer()}} function (see [[[#validation-arraybuffer-example]]] and [[[#stream-example]]]).
1000+ </ p >
1001+ < p class ="advisement " id ="non-validating-value-warning " title ="Implications for not using validation ">
1002+ < strong > Warning:</ strong > Disabling validation may introduce risks, particularly when interacting
1003+ with remote Things, as mismatches in data formats or schema expectations can lead to
1004+ unforeseen bugs and vulnerabilities. For more details, see the < a data-cite ="wot-thing-description11#behavior-data "> consumer assertions</ a > .
1005+ </ p >
9951006 </ section >
9961007
9971008 < section > < h3 > The < dfn > arrayBuffer()</ dfn > function</ h3 >
@@ -2463,10 +2474,25 @@ <h2>ConsumedThing Examples</h2>
24632474 // image: ArrayBuffer [0x1 0x2 0x3 0x5 0x15 0x23 ...]
24642475 }
24652476 </ pre >
2477+ < aside id ="validation-arraybuffer-example " class ="example " title ="Read data without validation using arraybuffer() ">
2478+ < p >
2479+ The {{InteractionOutput/arrayBuffer()}} can be used as a shortcut to skip the validation of the {{value()}} function.
2480+ See < a href ="#non-validating-value-warning "> relevant warning</ a > for the implications.
2481+ </ p >
2482+ < pre >
2483+ try{
2484+ // output is an InteractionOutput instance
2485+ const value = JSON.parse(Buffer.from(await output.arrayBuffer()).toString())
2486+ // ... custom validation
2487+ } catch(ex) {
2488+ // deal with parsing errors.
2489+ }
2490+ </ pre >
2491+ </ aside >
24662492 < p >
24672493 Finally, the next two examples shows the usage of a {{ReadableStream}} from an {{InteractionOutput}}.
24682494 </ p >
2469- < pre class ="example " title ="Thing Client API example with readable stream (e.g., video stream) ">
2495+ < pre id =" stream-example " class ="example " title ="Thing Client API example with readable stream (e.g., video stream) ">
24702496 /*{
24712497 "video": {
24722498 "description" : "the video stream of this camera",
0 commit comments