Started adding more content to openapi
This commit is contained in:
parent
8422e8bfef
commit
6a7c305468
2 changed files with 46 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ from openflexure_microscope.paths import (
|
||||||
OPENFLEXURE_VAR_PATH,
|
OPENFLEXURE_VAR_PATH,
|
||||||
logs_file_path,
|
logs_file_path,
|
||||||
)
|
)
|
||||||
|
from .openapi import add_spec_extras
|
||||||
|
|
||||||
|
|
||||||
# Custom RotatingFileHandler subclass
|
# Custom RotatingFileHandler subclass
|
||||||
|
|
@ -209,6 +210,8 @@ def routes():
|
||||||
def api_v1_catch_all(path): # pylint: disable=W0613
|
def api_v1_catch_all(path): # pylint: disable=W0613
|
||||||
abort(410, "API v1 is no longer in use. Please upgrade your client.")
|
abort(410, "API v1 is no longer in use. Please upgrade your client.")
|
||||||
|
|
||||||
|
add_spec_extras(labthing.spec)
|
||||||
|
|
||||||
|
|
||||||
# Automatically clean up microscope at exit
|
# Automatically clean up microscope at exit
|
||||||
def cleanup():
|
def cleanup():
|
||||||
|
|
|
||||||
43
openflexure_microscope/api/openapi.py
Normal file
43
openflexure_microscope/api/openapi.py
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
|
||||||
|
API_TAGS = [
|
||||||
|
{
|
||||||
|
"name": "actions",
|
||||||
|
"description": (
|
||||||
|
"Actions that can be run on the microscope. These endpoints represent "
|
||||||
|
"actions that many not complete immediately, so they run on the server "
|
||||||
|
"as `Action` objects and their status can be queried using the links "
|
||||||
|
"embedded in the JSON action description."
|
||||||
|
),
|
||||||
|
"externalDocs": "https://iot.mozilla.org/wot/#action-resource",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "properties",
|
||||||
|
"description": (
|
||||||
|
"Properties can be read and/or written to, and affect the "
|
||||||
|
"state of the microscope."
|
||||||
|
),
|
||||||
|
"externalDocs": "https://iot.mozilla.org/wot/#property-resource",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "captures",
|
||||||
|
"description": "",
|
||||||
|
"externalDocs": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "extensions",
|
||||||
|
"description": "",
|
||||||
|
"externalDocs": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "events",
|
||||||
|
"description": "",
|
||||||
|
"externalDocs": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
def add_spec_extras(spec):
|
||||||
|
"""Add extra documentation and features to the OpenAPI spec"""
|
||||||
|
# Add a list of tags, so we can control ordering and add descriptions
|
||||||
|
for t in API_TAGS:
|
||||||
|
spec.tag(t)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue