Skip to content

Commit 4c057c7

Browse files
author
Joel Collins
committed
Convert property schemas
1 parent a5bc9f6 commit 4c057c7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

labthings/server/views/docs/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class W3CThingDescriptionView(View):
4444
def get(self):
4545
base_url = request.host_url.rstrip("/")
4646

47+
swag = current_labthing().spec
48+
4749
props = {}
4850
for key, prop in current_labthing().properties.items():
4951
props[key] = {}
@@ -52,21 +54,21 @@ def get(self):
5254

5355
# Look for a _propertySchema in the Property classes API SPec
5456
prop_spec = get_spec(prop)
55-
prop_schema = prop_spec.get("_propertySchema")
57+
prop_schema = convert_schema(prop_spec.get("_propertySchema"), swag)
5658
if not prop_schema:
5759
# If prop is read-only
5860
if hasattr(prop, "get") and not (
5961
hasattr(prop, "post") or hasattr(prop, "put")
6062
):
61-
prop_schema = get_spec(prop.get).get("_schema").get(200)
63+
prop_schema = convert_schema(get_spec(prop.get).get("_schema").get(200), swag)
6264
# If prop is write-only
6365
elif not hasattr(prop, "get") and (
6466
hasattr(prop, "post") or hasattr(prop, "put")
6567
):
6668
if hasattr(prop, "post"):
67-
prop_schema = get_spec(prop.post).get("_params")
69+
prop_schema = convert_schema(get_spec(prop.post).get("_params"), swag)
6870
elif hasattr(prop, "put"):
69-
prop_schema = get_spec(prop.put).get("_params")
71+
prop_schema = convert_schema(get_spec(prop.put).get("_params"), swag)
7072
else:
7173
prop_schema = {}
7274

0 commit comments

Comments
 (0)