-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (25 loc) · 798 Bytes
/
main.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
from fastapi.responses import RedirectResponse
from fastapi.openapi.utils import get_openapi
from fastapi import FastAPI
app = FastAPI()
def custom_openapi():
if app.openapi_schema:
return app.openapi_schema
documented_routes = []
for r in app.routes:
if not r.path == "/":
documented_routes.append(r)
openapi_schema = get_openapi(
title="SAP RFC Bridge",
version="1.0.0",
description="Provides a bridge to communicate with SAP ECC",
routes=documented_routes,
)
app.openapi_schema = openapi_schema
return app.openapi_schema
app.openapi = custom_openapi
@app.get("/")
def read_root():
return RedirectResponse("/docs")
from routers.call import router as call_router
app.include_router(call_router)