Skip to content

Commit e308572

Browse files
committed
new release
1 parent 6e88964 commit e308572

4 files changed

Lines changed: 19 additions & 12 deletions

File tree

‎python_framework/api/resource/Globals.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ Globals:
2121
update: False
2222
list:
2323
web: [globals,python_helper,Popen,Path,numpy,pywin32,sqlalchemy]
24+
git:
25+
force-upgrade-command: pip install --upgrade --force python_framework

‎python_framework/api/src/service/openapi/OpenApiDocumentationFile.py‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,26 @@
22
from python_helper import Constant as c
33
from python_helper import StringHelper
44

5-
KW_OPEN_API = 'swagger'
5+
6+
KW_UI = 'ui'
67
KW_JSON = 'json'
8+
KW_API = 'api'
9+
KW_RESOURCE = 'resource'
10+
KW_OPEN_API = 'swagger'
711
DOCUMENTATION_FILE = f'{KW_OPEN_API}{c.DOT}{KW_JSON}'
812

13+
def getDocumentationFolderPath(apiInstance):
14+
globals = apiInstance.globals
15+
return f'{globals.currentPath}{KW_API}{globals.OS_SEPARATOR}{KW_RESOURCE}{globals.OS_SEPARATOR}{KW_OPEN_API}{KW_UI}'
16+
# return f'{apiInstance.documentationFolder}{g.OS_SEPARATOR}{DOCUMENTATION_FILE}'
17+
918
def getDocumentationFilePath(apiInstance):
1019
# return f'{g.apiPath}api{g.OS_SEPARATOR}resource{g.OS_SEPARATOR}swaggerui{g.OS_SEPARATOR}swagger.json'
11-
return f'{apiInstance.documentationFolder}{g.OS_SEPARATOR}{DOCUMENTATION_FILE}'
20+
return f'{getDocumentationFolderPath(apiInstance)}{globals.OS_SEPARATOR}{DOCUMENTATION_FILE}'
1221

1322
def loadDocumentationAsString(apiInstance):
1423
documentationFilePath = getDocumentationFilePath(apiInstance)
15-
with open(documentationFilePathapiInstance.documentationFolder, globals.READ, encoding=globals.ENCODING) as documentationFile :
24+
with open(documentationFilePath, globals.READ, encoding=globals.ENCODING) as documentationFile :
1625
documentationAsString = c.NOTHING.join(documentationFile.readlines())
1726
return documentationAsString
1827

‎python_framework/api/src/service/openapi/OpenApiManager.py‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
from python_framework.api.src.service.openapi.OpenApiKey import Key as k
77
from python_framework.api.src.service.openapi.OpenApiValue import Value as v
88
from python_framework.api.src.service.openapi import OpenApiDocumentationFile
9-
from python_framework.api.src.service.openapi.OpenApiDocumentationFile import KW_OPEN_API, KW_JSON, DOCUMENTATION_FILE
9+
from python_framework.api.src.service.openapi.OpenApiDocumentationFile import DOCUMENTATION_FILE, KW_OPEN_API
1010

11-
KW_UI = 'ui'
12-
OPEN_API_URL = f'/{OpenApiDocumentationFile.KW_OPEN_API}'
1311
COLON_DOUBLE_BAR = '://'
1412
LOCAL_HOST = 'localhost'
1513

@@ -49,8 +47,6 @@
4947
KW_HOST = 'host'
5048
KW_SCHEMES = 'schemes'
5149

52-
KW_RESOURCE = 'resource'
53-
5450
KW_URL_SET = '__URL_SET__'
5551
KW_DESCRIPTION_LIST = '__DESCRIPTION_LIST__'
5652
KW_CONTROLLER = '__CONTROLLER__'
@@ -61,13 +57,13 @@
6157

6258
def addSwagger(apiInstance, appInstance):
6359
globals = apiInstance.globals
64-
documentationUrl = f'{apiInstance.baseUrl}{OPEN_API_URL}'
60+
documentationUrl = f'{apiInstance.baseUrl}{SLASH}{KW_OPEN_API}'
6561
swaggerUi = get_swaggerui_blueprint(
6662
documentationUrl,
6763
DOCUMENTATION_FILE
6864
)
69-
# swaggerUi._static_folder = f'{globals.currentPath}{KW_API}{globals.OS_SEPARATOR}{KW_RESOURCE}{globals.OS_SEPARATOR}{KW_OPEN_API}{KW_UI}{globals.OS_SEPARATOR}'
70-
appInstance.documentationFolder = swaggerUi._static_folder
65+
swaggerUi._static_folder = f'{OpenApiDocumentationFile(apiInstance)}{globals.OS_SEPARATOR}'
66+
# appInstance.documentationFolder = swaggerUi._static_folder
7167
appInstance.register_blueprint(swaggerUi, url_prefix=documentationUrl)
7268
OpenApiDocumentationFile.overrideDocumentation(apiInstance)
7369

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from distutils.core import setup
22

3-
version = '0.0.1-16'
3+
version = '0.0.1-17'
44
name = 'python_framework'
55
url = f'https://github.com/SamuelJansen/{name}/'
66

0 commit comments

Comments
 (0)