Fixed content dicts to be valid OpenAPI

For functions that return JPEGs, we were
 using "content_type": "image/jpeg"
 instead we should use "content": { "image/jpeg": {}}
This commit is contained in:
Richard 2021-07-13 22:52:10 +01:00
parent 9892c7079a
commit 50ad9d4369
3 changed files with 12 additions and 5 deletions

View file

@ -71,7 +71,7 @@ class RAMCaptureAPI(ActionView):
args = BasicCaptureArgs() args = BasicCaptureArgs()
responses = { responses = {
200: { 200: {
"content_type": "image/jpeg", "content": { "image/jpeg": {} },
"description": "A JPEG image, representing the capture" "description": "A JPEG image, representing the capture"
} }
} }

View file

@ -14,14 +14,14 @@ class LSTImageProperty(PropertyView):
responses = { responses = {
200: { 200: {
"content_type": "image/png", "content": { "image/jpeg": {} },
"description": "Lens-shading table in RGB format", "description": "Lens-shading table in RGB format",
} }
} }
def get(self): def get(self):
""" """
Get the stage geometry. Get the lens shading table as an image.
""" """
microscope = find_component("org.openflexure.microscope") microscope = find_component("org.openflexure.microscope")

View file

@ -19,7 +19,9 @@ class MjpegStream(PropertyView):
responses = { responses = {
200: { 200: {
"content_type": "multipart/x-mixed-replace", "content": {
"multipart/x-mixed-replace": {}
},
"description": ( "description": (
"An MJPEG stream of camera images.\n\n" "An MJPEG stream of camera images.\n\n"
"This endpoint will serve JPEG images sequentially, \n" "This endpoint will serve JPEG images sequentially, \n"
@ -60,7 +62,12 @@ class SnapshotStream(PropertyView):
Single JPEG snapshot from the camera stream Single JPEG snapshot from the camera stream
""" """
responses = {200: {"content_type": "image/jpeg", "description": "Snapshot taken"}} responses = {
200: {
"content": { "image/jpeg": {} },
"description": "Snapshot taken"
}
}
def get(self): def get(self):
""" """