You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: draft-mohan-asdf-sdf-protocol-mapping.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -326,6 +326,46 @@ For example, a Zigbee protocol mapping for a temperature property might look lik
326
326
The protocol mapping mechanism can also be used for IP-based protocols
327
327
such as HTTP or CoAP.
328
328
329
+
### HTTP
330
+
331
+
The HTTP protocol mapping allows SDF models to specify how properties, actions,
332
+
and events should be accessed using the HTTP protocol. The mapping includes
333
+
details such as method, path, optional headers, request body and query
334
+
parameters that are used to access the corresponding SDF affordances.
335
+
336
+
~~~ cddl
337
+
{::include cddl/http-protocol-map.cddl}
338
+
~~~
339
+
{: #httpmap1 title="CDDL definition for HTTP OpenAPI Protocol Mapping for properties, actions, and events"}
340
+
341
+
Where:
342
+
343
+
- `method`is the method of the HTTP request towards the affordance. Allowed methods are `GET`, `POST`, `PUT`, and `DELETE`.
344
+
- `path`is the path targeted by the HTTP request.
345
+
- `query`is the optional query string expressed as a text map. The key of the map is the name of the query parameter and the value of the map is the value of the query parameter.
346
+
- `headers`is the optional set of HTTP headers expressed as text map. The key of the map is the name of the header and the value of the map is the value of the header field.
347
+
- `body`is the optional body of the HTTP request expressed as text.
348
+
349
+
For example, a HTTP protocol mapping for a temperature property might look like:
350
+
351
+
~~~ jsonc
352
+
{
353
+
"sdfProperty": {
354
+
"temperature": {
355
+
"sdfProtocolMap": {
356
+
"http": {
357
+
"method": "GET",
358
+
"path": "/device/123/temperature/0",
359
+
"query": {"unit": "celsius"},
360
+
}
361
+
}
362
+
}
363
+
}
364
+
}
365
+
~~~
366
+
367
+
The above SDF Protocol Mapping will be resolved to the following HTTP request: `GET /device/123/temperature/0?unit=celsius`.
368
+
329
369
### OpenAPI Protocol Mapping Structure
330
370
331
371
In the case of HTTP, SDF protocol mappings towards an SDF quality MAY be
0 commit comments