hololinked.td.data_schema.DataSchema
Bases: Schema
Implements Data Schema, usually used to represent payloads of properties, actions and events in a WoT Thing Description.
Source code in hololinked/hololinked/td/data_schema.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
Functions
ds_build_fields_from_property
populates schema information from property descriptor object
Source code in hololinked/hololinked/td/data_schema.py
ds_build_from_property
generates the schema specific to the property type,
calls ds_build_fields_from_property() after choosing the right type
Source code in hololinked/hololinked/td/data_schema.py
TD Supported Fields
| field | supported | meaning | default usage |
|---|---|---|---|
| title | ✔️ | Provides a human-readable title | label of Property or first line of docstring |
| titles | ➖ | Provides multi-language human-readable titles | to be manually set |
| description | ✔️ | Provides additional human-readable information | cleaned docstring of Property (doc value) |
| descriptions | ➖ | Provides multi-language human-readable descriptions | to be manually set |
| const | ✔️ | true when value will remain constant |
Property.constant value |
| default | ✔️ | Provides a default value | Property.default value |
| format | ➖ | format pattern such as "date-time", "email", "uri", etc. | to be manually set, will be supported in a future release |
| readOnly | ✔️ | true when value is read-only |
Property.readonly value |
| writeOnly | ❌ | true when value is write-only |
It is assumed that a property always has an associated value that can be read |
| unit | ✔️ | Provides a human-readable unit | Property.metadata["unit"] value |
| type | ✔️ | Provides a type for the property | typed inferred from specific subclass of Property, pydantic models are considered as an object currently even when having only one field or a root model (will be fixed in a future release |
| oneOf | ✔️ | Provides a list of possible values | Usually for properties with allow_None apart from its own type |
See subclasses for more specific fields under same topic.