Get default description and summary from docstring
This commit is contained in:
parent
b0316ae494
commit
3bcfd86ccc
1 changed files with 4 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ from .utilities import rupdate
|
||||||
from apispec import APISpec
|
from apispec import APISpec
|
||||||
from apispec.ext.marshmallow import MarshmallowPlugin
|
from apispec.ext.marshmallow import MarshmallowPlugin
|
||||||
|
|
||||||
|
from openflexure_microscope.common.labthings_core.utilities import get_docstring
|
||||||
|
|
||||||
from .fields import Field
|
from .fields import Field
|
||||||
from marshmallow import Schema as BaseSchema
|
from marshmallow import Schema as BaseSchema
|
||||||
|
|
||||||
|
|
@ -13,6 +15,8 @@ def view2path(rule: str, view: Resource, spec: APISpec):
|
||||||
params = {
|
params = {
|
||||||
"path": rule, # TODO: Validate this slightly (leading / etc)
|
"path": rule, # TODO: Validate this slightly (leading / etc)
|
||||||
"operations": view2operations(view, spec),
|
"operations": view2operations(view, spec),
|
||||||
|
"description": get_docstring(view),
|
||||||
|
"summary": get_docstring(view).partition("\n")[0].strip()
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasattr(view, "__apispec__"):
|
if hasattr(view, "__apispec__"):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue