5
5
import os
6
6
from copy import deepcopy
7
7
from functools import wraps
8
- from io import StringIO
9
8
from typing import Optional , List , Dict , Union , Any , Type , Callable , Tuple
10
9
11
- from flask import Flask , Blueprint , render_template , make_response
10
+ from flask import Flask , Blueprint , render_template
12
11
from flask .wrappers import Response
13
12
from pydantic import BaseModel
14
13
15
14
from .api_blueprint import APIBlueprint
16
15
from .commands import openapi_command
17
16
from .do_wrapper import _do_wrapper
18
17
from .http import HTTPMethod
19
- from .markdown import openapi_to_markdown
20
18
from .models import Info , APISpec , Tag , Components , Server
21
19
from .models .common import Reference , ExternalDocumentation
22
20
from .models .oauth import OAuthConfig
@@ -148,11 +146,6 @@ def init_doc(self) -> None:
148
146
api_doc_url = self .api_doc_url .lstrip ('/' )
149
147
)
150
148
)
151
- blueprint .add_url_rule (
152
- rule = '/markdown' ,
153
- endpoint = 'markdown' ,
154
- view_func = lambda : self .export_to_markdown ()
155
- )
156
149
blueprint .add_url_rule (
157
150
rule = '/' ,
158
151
endpoint = 'index' ,
@@ -165,17 +158,6 @@ def init_doc(self) -> None:
165
158
)
166
159
self .register_blueprint (blueprint )
167
160
168
- def export_to_markdown (self ) -> Response :
169
- """Export to markdown(Experimental)"""
170
- md = StringIO ()
171
-
172
- md .write (openapi_to_markdown (self .api_doc ))
173
-
174
- r = make_response (md .getvalue ())
175
- r .headers ['Content-Disposition' ] = 'attachment; filename=api.md'
176
-
177
- return r
178
-
179
161
@property
180
162
def api_doc (self ) -> Dict :
181
163
"""Generate Specification json"""
0 commit comments