From 3bcfd86cccfe3a28fd6bcc32ba70f12407df5db0 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Thu, 2 Jan 2020 22:43:24 +0000 Subject: [PATCH] Get default description and summary from docstring --- openflexure_microscope/common/flask_labthings/spec.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openflexure_microscope/common/flask_labthings/spec.py b/openflexure_microscope/common/flask_labthings/spec.py index 618f34f0..356f4de3 100644 --- a/openflexure_microscope/common/flask_labthings/spec.py +++ b/openflexure_microscope/common/flask_labthings/spec.py @@ -4,6 +4,8 @@ from .utilities import rupdate from apispec import APISpec from apispec.ext.marshmallow import MarshmallowPlugin +from openflexure_microscope.common.labthings_core.utilities import get_docstring + from .fields import Field from marshmallow import Schema as BaseSchema @@ -13,6 +15,8 @@ def view2path(rule: str, view: Resource, spec: APISpec): params = { "path": rule, # TODO: Validate this slightly (leading / etc) "operations": view2operations(view, spec), + "description": get_docstring(view), + "summary": get_docstring(view).partition("\n")[0].strip() } if hasattr(view, "__apispec__"):