Skip to content

Commit 0846595

Browse files
authored
Merge pull request road-core#332 from tisnik/bug-fix-schema-generator
Bug fix: schema generator
2 parents 8203c1d + e298527 commit 0846595

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/generate_openapi_schema.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
import json
44
import os.path
5+
import pprint
56
import sys
67

78
from fastapi.openapi.utils import get_openapi
89

910
# we need to import OLS app from directory above, so it is needed to update
1011
# search path accordingly
11-
sys.path.append(
12-
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
12+
# it needs to go into the 1st place to be used first
13+
sys.path.insert(
14+
0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
1315
)
1416

1517
# pylint: disable-next=C0413
@@ -40,6 +42,11 @@
4042
print(app.title)
4143
print(app.description)
4244

45+
print()
46+
47+
print("Routes:")
48+
pprint.pprint(app.routes)
49+
4350
# retrieve OpenAPI schema via initialized app
4451
open_api = get_openapi(
4552
title=app.title,

0 commit comments

Comments
 (0)