Skip to content

Commit 31a7a04

Browse files
author
Joel Collins
committed
Handle missing schema better
1 parent 2425bd2 commit 31a7a04

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/labthings/server/default_views/root.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33

44

55
class RootView(View):
6+
"""W3C Thing Description"""
7+
68
def get(self):
79
return current_labthing().thing_description.to_dict()

src/labthings/server/spec/apispec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ def view_to_apispec_operations(view, apispec: APISpec):
6969
"content": {
7070
getattr(view, "content_type", "application/json"): {
7171
"schema": convert_to_schema_or_json(schema, apispec)
72-
or Schema()
7372
}
73+
if schema
74+
else {} # If no schema is defined, don't include one in the APISpec
7475
},
7576
}
7677
else:

0 commit comments

Comments
 (0)