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: README.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -337,5 +337,49 @@ W3C Web of Things (WoT) offers a mechanism that things can propagate metadata us
337
337
338
338
For more details, refer to the official [W3C Web of Things](https://www.w3.org/WoT/) website.
339
339
340
+
## Kotlin TD DSL
341
+
342
+
If you don't like annotations and prefer to build Thing Descriptions in code, you can also make use of a type-safe Kotlin DSL to define Thing Descriptions.
343
+
344
+
```
345
+
wot.produce {
346
+
id = "agent"
347
+
title = "Agent"
348
+
objectType = Type("Agent")
349
+
intProperty("propertyName1") {
350
+
minimum = 0
351
+
maximum = 100
352
+
observable = true
353
+
unit = "percent"
354
+
}
355
+
stringSchema("propertyName2") {
356
+
title = "Property 2"
357
+
minLength = 5
358
+
maxLength = 10
359
+
}
360
+
action<String, Map<*, *>>("inOutAction") {
361
+
title = "title"
362
+
description = "Description of an action"
363
+
input = stringSchema {
364
+
title = "Action Input"
365
+
minLength = 10
366
+
default = "test"
367
+
}
368
+
output = objectSchema {
369
+
stringProperty("output")
370
+
}
371
+
}
372
+
event<String, Nothing, Nothing>("statusUpdated") { data = StringSchema() }
0 commit comments