openflexure-microscope-server/openflexure_microscope/api/v2/views/docs.py
2021-07-19 20:29:13 +01:00

23 lines
553 B
Python

from flask import Response
from labthings import current_labthing
from labthings.views import View
class APISpecJSONView(View):
"""OpenAPI v3 documentation
A JSON document containing an API description in OpenAPI format
"""
def get(self):
return current_labthing().spec.to_dict()
class APISpecYAMLView(View):
"""OpenAPI v3 documentation
A YAML document containing an API description in OpenAPI format
"""
def get(self):
return Response(current_labthing().spec.to_yaml(), mimetype="text/yaml")