Skip to content

Commit 38fb5ca

Browse files
committed
Documented parameters for actions & static
Path parameters were previously missing from OpenAPI YAML.
1 parent 5f9d284 commit 38fb5ca

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/labthings/default_views/actions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ def get(self):
2828
}
2929

3030

31+
TASK_ID_PARAMETER = {
32+
"name": "task_id",
33+
"in": "path",
34+
"description": "The unique ID of the action",
35+
"required": True,
36+
"schema": {"type": "string"},
37+
"example": "eeae7ae9-0c0d-45a4-9ef2-7b84bb67a1d1",
38+
}
39+
40+
3141
class ActionObjectView(View):
3242
"""Manage a particular action.
3343
@@ -37,6 +47,8 @@ class ActionObjectView(View):
3747
3848
"""
3949

50+
parameters = [TASK_ID_PARAMETER]
51+
4052
def get(self, task_id):
4153
"""Show the status of an Action
4254

src/labthings/views/builder.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ def _get(_, path=""):
5050
}
5151

5252
# Generate a basic property class
53-
generated_class = type(name, (View, object), {"get": _get})
53+
generated_class = type(
54+
name,
55+
(View, object),
56+
{
57+
"get": _get,
58+
"parameters": [
59+
{
60+
"name": "path",
61+
"in": "path",
62+
"description": "Path to the static file",
63+
"required": True,
64+
"schema": {"type": "string"},
65+
"example": "style.css",
66+
}
67+
],
68+
},
69+
)
5470

5571
return generated_class

0 commit comments

Comments
 (0)