python-rest-client-codegen 1.7.6__py3-none-any.whl → 1.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_rest_client_codegen/codegen.py +80 -80
- python_rest_client_codegen/python-rest-client-codegen-tests.jar +0 -0
- python_rest_client_codegen/python-rest-client-codegen.jar +0 -0
- {python_rest_client_codegen-1.7.6.dist-info → python_rest_client_codegen-1.8.0.dist-info}/METADATA +1 -1
- python_rest_client_codegen-1.8.0.dist-info/RECORD +9 -0
- python_rest_client_codegen-1.7.6.dist-info/RECORD +0 -9
- {python_rest_client_codegen-1.7.6.dist-info → python_rest_client_codegen-1.8.0.dist-info}/WHEEL +0 -0
- {python_rest_client_codegen-1.7.6.dist-info → python_rest_client_codegen-1.8.0.dist-info}/top_level.txt +0 -0
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import subprocess
|
|
2
|
-
import os
|
|
3
|
-
import sys
|
|
4
|
-
import lcdp_api.rest
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
try:
|
|
8
|
-
import importlib.resources as pkg_resources
|
|
9
|
-
except ImportError:
|
|
10
|
-
# Try backported to PY<37 `importlib_resources`.
|
|
11
|
-
import importlib_resources as pkg_resources
|
|
12
|
-
|
|
13
|
-
# Get current script dir
|
|
14
|
-
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
15
|
-
|
|
16
|
-
# Codegen command constants
|
|
17
|
-
OPENAPI_CODEGEN_CLASS = "org.openapitools.codegen.OpenAPIGenerator"
|
|
18
|
-
|
|
19
|
-
def get_api_path(api_filename):
|
|
20
|
-
return pkg_resources.path(lcdp_api.rest, api_filename)
|
|
21
|
-
|
|
22
|
-
def get_codegen_cli_path():
|
|
23
|
-
return pkg_resources.path(__package__, "openapi-generator-cli.jar")
|
|
24
|
-
|
|
25
|
-
def get_codegen_path():
|
|
26
|
-
return pkg_resources.path(__package__, "python-rest-client-codegen.jar")
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def generate_consumer(api_spec_file_name, out_dir):
|
|
30
|
-
with get_api_path(api_spec_file_name) as api_spec_file_path:
|
|
31
|
-
api_name = get_api_name_from_spec_file_path(api_spec_file_path)
|
|
32
|
-
|
|
33
|
-
api_spec_file_abs_path = os.path.join(CURRENT_DIR, "..", api_spec_file_path)
|
|
34
|
-
|
|
35
|
-
# Compute generator path
|
|
36
|
-
with get_codegen_path() as client_codegen_jar_path, get_codegen_cli_path() as cli_jar_path:
|
|
37
|
-
openapi_codegen_java_classpath = compute_codegen_java_classpath(cli_jar_path, client_codegen_jar_path)
|
|
38
|
-
|
|
39
|
-
execute_consumer_codegen(openapi_codegen_java_classpath, client_codegen_jar_path.stem, api_spec_file_abs_path,
|
|
40
|
-
out_dir, "api.consume.gen", api_name)
|
|
41
|
-
|
|
42
|
-
def get_api_name_from_spec_file_path(api_spec_file_path):
|
|
43
|
-
api_name = os.path.basename(api_spec_file_path).split(".")[0]
|
|
44
|
-
return api_name.replace("-", "_")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def compute_codegen_java_classpath(cli_jar_path, codegen_jar_path):
|
|
48
|
-
sep = ";" if os.name == "nt" else ":"
|
|
49
|
-
return sep.join([str(cli_jar_path), str(codegen_jar_path)])
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def execute_consumer_codegen(openapi_codegen_java_classpath, codegen_name,
|
|
53
|
-
api_spec_file_path, outdir,
|
|
54
|
-
package_name, api_name):
|
|
55
|
-
"""
|
|
56
|
-
Consumer is generated in leaf
|
|
57
|
-
"""
|
|
58
|
-
|
|
59
|
-
properties = [
|
|
60
|
-
"--package-name", package_name + '.' + api_name,
|
|
61
|
-
"--model-package", 'models',
|
|
62
|
-
"--api-package", 'controllers',
|
|
63
|
-
]
|
|
64
|
-
|
|
65
|
-
additional_properties = [
|
|
66
|
-
"generateSourceCodeOnly=true", # Used on client generation to not build setup.py, etc...
|
|
67
|
-
]
|
|
68
|
-
|
|
69
|
-
execute_codegen_command(openapi_codegen_java_classpath, codegen_name, api_spec_file_path, outdir, properties,
|
|
70
|
-
additional_properties)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def execute_codegen_command(openapi_codegen_java_classpath, codegen_name, api_spec_file_path, outdir, properties,
|
|
74
|
-
additional_properties):
|
|
75
|
-
subprocess.check_call(["java", "-cp", openapi_codegen_java_classpath, OPENAPI_CODEGEN_CLASS, "generate", "-g",
|
|
76
|
-
codegen_name, "-i", api_spec_file_path, "-o", outdir] +
|
|
77
|
-
properties +
|
|
78
|
-
# controllerPackage is used by server codegen
|
|
79
|
-
["--additional-properties=" + ",".join(additional_properties)
|
|
80
|
-
])
|
|
1
|
+
import subprocess
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import lcdp_api.rest
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import importlib.resources as pkg_resources
|
|
9
|
+
except ImportError:
|
|
10
|
+
# Try backported to PY<37 `importlib_resources`.
|
|
11
|
+
import importlib_resources as pkg_resources
|
|
12
|
+
|
|
13
|
+
# Get current script dir
|
|
14
|
+
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
15
|
+
|
|
16
|
+
# Codegen command constants
|
|
17
|
+
OPENAPI_CODEGEN_CLASS = "org.openapitools.codegen.OpenAPIGenerator"
|
|
18
|
+
|
|
19
|
+
def get_api_path(api_filename):
|
|
20
|
+
return pkg_resources.path(lcdp_api.rest, api_filename)
|
|
21
|
+
|
|
22
|
+
def get_codegen_cli_path():
|
|
23
|
+
return pkg_resources.path(__package__, "openapi-generator-cli.jar")
|
|
24
|
+
|
|
25
|
+
def get_codegen_path():
|
|
26
|
+
return pkg_resources.path(__package__, "python-rest-client-codegen.jar")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def generate_consumer(api_spec_file_name, out_dir):
|
|
30
|
+
with get_api_path(api_spec_file_name) as api_spec_file_path:
|
|
31
|
+
api_name = get_api_name_from_spec_file_path(api_spec_file_path)
|
|
32
|
+
|
|
33
|
+
api_spec_file_abs_path = os.path.join(CURRENT_DIR, "..", api_spec_file_path)
|
|
34
|
+
|
|
35
|
+
# Compute generator path
|
|
36
|
+
with get_codegen_path() as client_codegen_jar_path, get_codegen_cli_path() as cli_jar_path:
|
|
37
|
+
openapi_codegen_java_classpath = compute_codegen_java_classpath(cli_jar_path, client_codegen_jar_path)
|
|
38
|
+
|
|
39
|
+
execute_consumer_codegen(openapi_codegen_java_classpath, client_codegen_jar_path.stem, api_spec_file_abs_path,
|
|
40
|
+
out_dir, "api.consume.gen", api_name)
|
|
41
|
+
|
|
42
|
+
def get_api_name_from_spec_file_path(api_spec_file_path):
|
|
43
|
+
api_name = os.path.basename(api_spec_file_path).split(".")[0]
|
|
44
|
+
return api_name.replace("-", "_")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def compute_codegen_java_classpath(cli_jar_path, codegen_jar_path):
|
|
48
|
+
sep = ";" if os.name == "nt" else ":"
|
|
49
|
+
return sep.join([str(cli_jar_path), str(codegen_jar_path)])
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def execute_consumer_codegen(openapi_codegen_java_classpath, codegen_name,
|
|
53
|
+
api_spec_file_path, outdir,
|
|
54
|
+
package_name, api_name):
|
|
55
|
+
"""
|
|
56
|
+
Consumer is generated in leaf
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
properties = [
|
|
60
|
+
"--package-name", package_name + '.' + api_name,
|
|
61
|
+
"--model-package", 'models',
|
|
62
|
+
"--api-package", 'controllers',
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
additional_properties = [
|
|
66
|
+
"generateSourceCodeOnly=true", # Used on client generation to not build setup.py, etc...
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
execute_codegen_command(openapi_codegen_java_classpath, codegen_name, api_spec_file_path, outdir, properties,
|
|
70
|
+
additional_properties)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def execute_codegen_command(openapi_codegen_java_classpath, codegen_name, api_spec_file_path, outdir, properties,
|
|
74
|
+
additional_properties):
|
|
75
|
+
subprocess.check_call(["java", "-cp", openapi_codegen_java_classpath, OPENAPI_CODEGEN_CLASS, "generate", "-g",
|
|
76
|
+
codegen_name, "-i", api_spec_file_path, "-o", outdir] +
|
|
77
|
+
properties +
|
|
78
|
+
# controllerPackage is used by server codegen
|
|
79
|
+
["--additional-properties=" + ",".join(additional_properties)
|
|
80
|
+
])
|
|
Binary file
|
|
Binary file
|
{python_rest_client_codegen-1.7.6.dist-info → python_rest_client_codegen-1.8.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-rest-client-codegen
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: Python rest client codegen for Le Comptoir Des Pharmacies
|
|
5
5
|
Home-page: https://bitbucket.org/lecomptoirdespharmacies/lcdp-openapi-codegen
|
|
6
6
|
Author: Le Comptoir Des Pharmacies
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
python_rest_client_codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
python_rest_client_codegen/codegen.py,sha256=vC6UVwFcoW9wItrWtdRqJ_lXfa4rUoyFoqz2-t70z0U,3003
|
|
3
|
+
python_rest_client_codegen/openapi-generator-cli.jar,sha256=0Yec9C2jH4z2HPaHmLjvJBivDGvZOlwYcOH_VD-7k2U,29755831
|
|
4
|
+
python_rest_client_codegen/python-rest-client-codegen-tests.jar,sha256=JISNUU_jW9VKPU1ouw8PmhLiHEjAmiVQoidPouK2d7U,459017
|
|
5
|
+
python_rest_client_codegen/python-rest-client-codegen.jar,sha256=-Wtnq_606fYC8E0-s-X3PQkgjhngeqW95HbHQ-0sr3s,21668
|
|
6
|
+
python_rest_client_codegen-1.8.0.dist-info/METADATA,sha256=TiEtRIDeer59GV_iS0q0xsKr6WDr-gFs5XggeT0GvIA,490
|
|
7
|
+
python_rest_client_codegen-1.8.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
8
|
+
python_rest_client_codegen-1.8.0.dist-info/top_level.txt,sha256=JBvqPcg3-ZBy_oSMQaLm9EWsLmlEetFmk0s47GGyYW8,27
|
|
9
|
+
python_rest_client_codegen-1.8.0.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
python_rest_client_codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
python_rest_client_codegen/codegen.py,sha256=pInoEppxdFK3r8df5zJM_OsInrrIQzsGLwNzkmOMoL0,3083
|
|
3
|
-
python_rest_client_codegen/openapi-generator-cli.jar,sha256=0Yec9C2jH4z2HPaHmLjvJBivDGvZOlwYcOH_VD-7k2U,29755831
|
|
4
|
-
python_rest_client_codegen/python-rest-client-codegen-tests.jar,sha256=RHmAevW_muxkTUogvYzF3oc-IsRA1ANnrprgXUs9yxc,459019
|
|
5
|
-
python_rest_client_codegen/python-rest-client-codegen.jar,sha256=ThcBr-bLd4aManvkqB6jFOJ7u0-LuDmGyqdMUIFdrWU,21670
|
|
6
|
-
python_rest_client_codegen-1.7.6.dist-info/METADATA,sha256=dW1vac9Agk0LNEbn69-z7LsvKqYAc83a0Yx3G7vvbwU,490
|
|
7
|
-
python_rest_client_codegen-1.7.6.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
8
|
-
python_rest_client_codegen-1.7.6.dist-info/top_level.txt,sha256=JBvqPcg3-ZBy_oSMQaLm9EWsLmlEetFmk0s47GGyYW8,27
|
|
9
|
-
python_rest_client_codegen-1.7.6.dist-info/RECORD,,
|
{python_rest_client_codegen-1.7.6.dist-info → python_rest_client_codegen-1.8.0.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|