-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.py
91 lines (80 loc) · 2.65 KB
/
docs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from flask import Blueprint, render_template, abort
from jinja2 import TemplateNotFound
from flasgger import APISpec, Schema, Swagger, fields
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
from common.schemas import *
from blueprints.v0 import *
# docs = Blueprint('docs_pages', __name__, )
def create_docs(app):
# Create an APISpec
# info: {
spec = APISpec(
title="ClassClock API",
version="0.3.3",
openapi_version='2.0',
plugins=[
FlaskPlugin(),
MarshmallowPlugin(),
],
# options= {
# "description": "The development version of the ClassClock API",
# "servers": [
# {
# "url": "https://api.classclock.app/v0",
# "description": "ClassClock API Server"
# },
# {
# "url": "https://localhost:8000/v0",
# "description": "Dev server"
# }
# ],
# "externalDocs": {
# "description": "This API might loosely follow the JSON:API specofocation",
# "url": "https://jsonapi.org"
# }#,
# "contact": {
# # "responsibleOrganization": "ME",
# # "responsibleDeveloper": "Me",
# # "email": "[email protected]",
# # "url": "www.me.com",
# },
# "termsOfService": "http://me.com/terms",
# }
)
template = spec.to_flasgger(
app,
definitions=[SchoolSchema, BellScheduleSchema],
paths=[get_school, get_bellschedule ]
)
# config={
# "headers": [
# ],
# "specs": [
# {
# "endpoint": 'apispec_v1',
# "route": '/apispec_v1.json',
# "rule_filter": lambda rule: True, # all in
# "model_filter": lambda tag: True, # all in
# }
# ],
# "static_url_path": "/flasgger_static",
# # "static_folder": "static", # must be set by user
# "swagger_ui": True,
# # "specs_route": "/v0/docs/",
# "basePath": "/docs",
# "host": "api.classclock.app", # overrides localhost:500
# "schemes": [
# "https"
# ],
# "securityDefinitions": {
# "ApiKeyAuth": {
# "type": "apiKey",
# "in": "header",
# "name": "Authentication"
# }
# }
# },
# template["basePath"] = "/docs"
swagger = Swagger(app, template=template)
return swagger