From 50ad9d4369b8f1e0ed67320afdb274345f35c378 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 13 Jul 2021 22:52:10 +0100 Subject: [PATCH] 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": {}} --- openflexure_microscope/api/v2/views/actions/camera.py | 2 +- openflexure_microscope/api/v2/views/camera.py | 4 ++-- openflexure_microscope/api/v2/views/streams.py | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/openflexure_microscope/api/v2/views/actions/camera.py b/openflexure_microscope/api/v2/views/actions/camera.py index 9d66ded6..65b94eee 100644 --- a/openflexure_microscope/api/v2/views/actions/camera.py +++ b/openflexure_microscope/api/v2/views/actions/camera.py @@ -71,7 +71,7 @@ class RAMCaptureAPI(ActionView): args = BasicCaptureArgs() responses = { 200: { - "content_type": "image/jpeg", + "content": { "image/jpeg": {} }, "description": "A JPEG image, representing the capture" } } diff --git a/openflexure_microscope/api/v2/views/camera.py b/openflexure_microscope/api/v2/views/camera.py index 5b96b0f8..abe0c32e 100644 --- a/openflexure_microscope/api/v2/views/camera.py +++ b/openflexure_microscope/api/v2/views/camera.py @@ -14,14 +14,14 @@ class LSTImageProperty(PropertyView): responses = { 200: { - "content_type": "image/png", + "content": { "image/jpeg": {} }, "description": "Lens-shading table in RGB format", } } def get(self): """ - Get the stage geometry. + Get the lens shading table as an image. """ microscope = find_component("org.openflexure.microscope") diff --git a/openflexure_microscope/api/v2/views/streams.py b/openflexure_microscope/api/v2/views/streams.py index a7c3805e..b9602103 100644 --- a/openflexure_microscope/api/v2/views/streams.py +++ b/openflexure_microscope/api/v2/views/streams.py @@ -19,7 +19,9 @@ class MjpegStream(PropertyView): responses = { 200: { - "content_type": "multipart/x-mixed-replace", + "content": { + "multipart/x-mixed-replace": {} + }, "description": ( "An MJPEG stream of camera images.\n\n" "This endpoint will serve JPEG images sequentially, \n" @@ -60,7 +62,12 @@ class SnapshotStream(PropertyView): 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): """