We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e241c96 commit 5b8401dCopy full SHA for 5b8401d
1 file changed
src/labthings/server/schema.py
@@ -89,14 +89,28 @@ class ActionSchema(Schema):
89
log = fields.List(fields.Dict())
90
91
href = fields.String()
92
+ links = fields.Dict()
93
94
@pre_dump
95
def generate_links(self, data, **kwargs):
96
+ # Add Mozilla format href
97
+ # TODO: This should eventually point to the Mozilla action URL
98
try:
99
url = url_for(TASK_ENDPOINT, task_id=data.id, _external=True)
100
except BuildError:
101
url = None
102
data.href = url
103
+
104
+ # Add full link description
105
+ # TODO: Reintroduce this type of link to other Thing Description elements
106
+ data.links = {
107
+ "self": {
108
+ "href": url,
109
+ "mimetype": "application/json",
110
+ **description_from_view(view_class_from_endpoint(TASK_ENDPOINT)),
111
+ }
112
113
114
return data
115
116
0 commit comments