Better handle response documentation

This commit is contained in:
jtc42 2020-01-06 22:28:00 +00:00
parent 1ccdad8a86
commit 8afb0757bd
12 changed files with 143 additions and 115 deletions

View file

@ -10,18 +10,14 @@ from openflexure_microscope.common.flask_labthings.find import (
find_extension,
)
from openflexure_microscope.common.flask_labthings.extensions import BaseExtension
from openflexure_microscope.common.flask_labthings.views.tasks import TaskSchema
from openflexure_microscope.common.flask_labthings.decorators import (
marshal_task,
marshal_with,
use_args,
)
from openflexure_microscope.common.flask_labthings import fields
from openflexure_microscope.devel import (
taskify,
abort,
update_task_progress,
)
from openflexure_microscope.devel import taskify, abort, update_task_progress
from openflexure_microscope.common.flask_labthings.resource import Resource
import time
@ -361,7 +357,7 @@ class TileScanAPI(Resource):
"resize": fields.Dict(missing=None), # TODO: Validate keys
}
)
@marshal_with(TaskSchema())
@marshal_task
def post(self, args):
microscope = find_device("openflexure_microscope")

View file

@ -2,7 +2,11 @@ import logging
import os
import errno
from werkzeug.exceptions import BadRequest
from flask import url_for, Blueprint
from flask import url_for, Blueprint, current_app
def view_class_from_endpoint(endpoint: str):
return current_app.view_functions[endpoint].view_class
def blueprint_for_module(module_name, api_ver=2, suffix=""):

View file

@ -35,7 +35,7 @@ class CaptureAPI(Resource):
}
)
@marshal_with(capture_schema)
@doc_response(200, "Capture successful")
@doc_response(200, description="Capture successful")
def post(self, args):
"""
Create a new capture