From b0316ae494a0b5368efc3bc78200f405026bd150 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Thu, 2 Jan 2020 21:42:03 +0000 Subject: [PATCH] Fixed default response docs --- .../common/flask_labthings/spec.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/openflexure_microscope/common/flask_labthings/spec.py b/openflexure_microscope/common/flask_labthings/spec.py index 4b01f139..618f34f0 100644 --- a/openflexure_microscope/common/flask_labthings/spec.py +++ b/openflexure_microscope/common/flask_labthings/spec.py @@ -21,11 +21,22 @@ def view2path(rule: str, view: Resource, spec: APISpec): return params -def view2operations(view: Resource, spec: APISpec): +def view2operations(view: Resource, spec: APISpec, populate_default: bool = True): ops = {} for method in Resource.methods: if hasattr(view, method): - ops[method] = {} + + if populate_default: + ops[method] = { + "responses": { + 200: { + "description": "success" + } + } + } + else: + ops[method] = {} + if hasattr(getattr(view, method), "__apispec__"): ops[method] = doc2operation(getattr(view, method).__apispec__, spec)