ez-code-generator 3.0.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.
ez-codegen/__main__.py ADDED
@@ -0,0 +1,8 @@
1
+ import os
2
+ import subprocess
3
+ import sys
4
+
5
+ abspath = os.path.abspath(__file__)
6
+ current_dir = os.path.dirname(abspath)
7
+ script_path = os.path.join(current_dir, 'bin', 'ez-codegen')
8
+ subprocess.call([script_path] + sys.argv[1:])
@@ -0,0 +1,251 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015-2021 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
20
+
21
+ ##############################################################################
22
+ #
23
+ # ez-codegen start up script for POSIX generated by Gradle.
24
+ #
25
+ # Important for running:
26
+ #
27
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
+ # noncompliant, but you have some other compliant shell such as ksh or
29
+ # bash, then to run this script, type that shell name before the whole
30
+ # command line, like:
31
+ #
32
+ # ksh ez-codegen
33
+ #
34
+ # Busybox and similar reduced shells will NOT work, because this script
35
+ # requires all of these POSIX shell features:
36
+ # * functions;
37
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
+ # * compound commands having a testable exit status, especially «case»;
40
+ # * various built-in commands including «command», «set», and «ulimit».
41
+ #
42
+ # Important for patching:
43
+ #
44
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
45
+ # by Bash, Ksh, etc; in particular arrays are avoided.
46
+ #
47
+ # The "traditional" practice of packing multiple parameters into a
48
+ # space-separated string is a well documented source of bugs and security
49
+ # problems, so this is (mostly) avoided, by progressively accumulating
50
+ # options in "$@", and eventually passing that to Java.
51
+ #
52
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
+ # and EZ_CODEGEN_OPTS) rely on word-splitting, this is performed explicitly;
54
+ # see the in-line comments for details.
55
+ #
56
+ # There are tweaks for specific operating systems such as AIX, CygWin,
57
+ # Darwin, MinGW, and NonStop.
58
+ #
59
+ # (3) This script is generated from the Groovy template
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
+ # within the Gradle project.
62
+ #
63
+ # You can find Gradle at https://github.com/gradle/gradle/.
64
+ #
65
+ ##############################################################################
66
+
67
+ # Attempt to set APP_HOME
68
+
69
+ # Resolve links: $0 may be a link
70
+ app_path=$0
71
+
72
+ # Need this for daisy-chained symlinks.
73
+ while
74
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
+ [ -h "$app_path" ]
76
+ do
77
+ ls=$( ls -ld "$app_path" )
78
+ link=${ls#*' -> '}
79
+ case $link in #(
80
+ /*) app_path=$link ;; #(
81
+ *) app_path=$APP_HOME$link ;;
82
+ esac
83
+ done
84
+
85
+ # This is normally unused
86
+ # shellcheck disable=SC2034
87
+ APP_BASE_NAME=${0##*/}
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}.." > /dev/null && printf '%s
90
+ ' "$PWD" ) || exit
91
+
92
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
93
+ MAX_FD=maximum
94
+
95
+ warn () {
96
+ echo "$*"
97
+ } >&2
98
+
99
+ die () {
100
+ echo
101
+ echo "$*"
102
+ echo
103
+ exit 1
104
+ } >&2
105
+
106
+ # OS specific support (must be 'true' or 'false').
107
+ cygwin=false
108
+ msys=false
109
+ darwin=false
110
+ nonstop=false
111
+ case "$( uname )" in #(
112
+ CYGWIN* ) cygwin=true ;; #(
113
+ Darwin* ) darwin=true ;; #(
114
+ MSYS* | MINGW* ) msys=true ;; #(
115
+ NONSTOP* ) nonstop=true ;;
116
+ esac
117
+
118
+ CLASSPATH=$APP_HOME/lib/ez-codegen-3.0.0.jar:$APP_HOME/lib/kotlin-reflect-2.1.20.jar:$APP_HOME/lib/kaml-jvm-0.77.0.jar:$APP_HOME/lib/okhttp-4.12.0.jar:$APP_HOME/lib/kotlin-stdlib-jdk8-1.8.21.jar:$APP_HOME/lib/kotlinx-serialization-json-jvm-1.7.3.jar:$APP_HOME/lib/kotlinx-serialization-core-jvm-1.7.3.jar:$APP_HOME/lib/snakeyaml-engine-kmp-jvm-3.1.1.jar:$APP_HOME/lib/okio-jvm-3.11.0.jar:$APP_HOME/lib/kotlin-stdlib-jdk7-1.8.21.jar:$APP_HOME/lib/urlencoder-lib-jvm-1.6.0.jar:$APP_HOME/lib/kotlin-stdlib-2.1.20.jar:$APP_HOME/lib/jcommander-1.82.jar:$APP_HOME/lib/annotations-13.0.jar
119
+
120
+
121
+ # Determine the Java command to use to start the JVM.
122
+ if [ -n "$JAVA_HOME" ] ; then
123
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
124
+ # IBM's JDK on AIX uses strange locations for the executables
125
+ JAVACMD=$JAVA_HOME/jre/sh/java
126
+ else
127
+ JAVACMD=$JAVA_HOME/bin/java
128
+ fi
129
+ if [ ! -x "$JAVACMD" ] ; then
130
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
131
+
132
+ Please set the JAVA_HOME variable in your environment to match the
133
+ location of your Java installation."
134
+ fi
135
+ else
136
+ JAVACMD=java
137
+ if ! command -v java >/dev/null 2>&1
138
+ then
139
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
140
+
141
+ Please set the JAVA_HOME variable in your environment to match the
142
+ location of your Java installation."
143
+ fi
144
+ fi
145
+
146
+ # Increase the maximum file descriptors if we can.
147
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
148
+ case $MAX_FD in #(
149
+ max*)
150
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151
+ # shellcheck disable=SC2039,SC3045
152
+ MAX_FD=$( ulimit -H -n ) ||
153
+ warn "Could not query maximum file descriptor limit"
154
+ esac
155
+ case $MAX_FD in #(
156
+ '' | soft) :;; #(
157
+ *)
158
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159
+ # shellcheck disable=SC2039,SC3045
160
+ ulimit -n "$MAX_FD" ||
161
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
162
+ esac
163
+ fi
164
+
165
+ # Collect all arguments for the java command, stacking in reverse order:
166
+ # * args from the command line
167
+ # * the main class name
168
+ # * -classpath
169
+ # * -D...appname settings
170
+ # * --module-path (only if needed)
171
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and EZ_CODEGEN_OPTS environment variables.
172
+
173
+ # For Cygwin or MSYS, switch paths to Windows format before running java
174
+ if "$cygwin" || "$msys" ; then
175
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
176
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
177
+
178
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
179
+
180
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
181
+ for arg do
182
+ if
183
+ case $arg in #(
184
+ -*) false ;; # don't mess with options #(
185
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
186
+ [ -e "$t" ] ;; #(
187
+ *) false ;;
188
+ esac
189
+ then
190
+ arg=$( cygpath --path --ignore --mixed "$arg" )
191
+ fi
192
+ # Roll the args list around exactly as many times as the number of
193
+ # args, so each arg winds up back in the position where it started, but
194
+ # possibly modified.
195
+ #
196
+ # NB: a `for` loop captures its iteration list before it begins, so
197
+ # changing the positional parameters here affects neither the number of
198
+ # iterations, nor the values presented in `arg`.
199
+ shift # remove old arg
200
+ set -- "$@" "$arg" # push replacement arg
201
+ done
202
+ fi
203
+
204
+
205
+ # Add default JVM options here. You can also use JAVA_OPTS and EZ_CODEGEN_OPTS to pass JVM options to this script.
206
+ DEFAULT_JVM_OPTS=""
207
+
208
+ # Collect all arguments for the java command:
209
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210
+ # and any embedded shellness will be escaped.
211
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212
+ # treated as '${Hostname}' itself on the command line.
213
+
214
+ set -- \
215
+ -classpath "$CLASSPATH" \
216
+ MainKt \
217
+ "$@"
218
+
219
+ # Stop when "xargs" is not available.
220
+ if ! command -v xargs >/dev/null 2>&1
221
+ then
222
+ die "xargs is not available"
223
+ fi
224
+
225
+ # Use "xargs" to parse quoted args.
226
+ #
227
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228
+ #
229
+ # In Bash we could simply go:
230
+ #
231
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232
+ # set -- "${ARGS[@]}" "$@"
233
+ #
234
+ # but POSIX shell has neither arrays nor command substitution, so instead we
235
+ # post-process each arg (as a line of input to sed) to backslash-escape any
236
+ # character that might be a shell metacharacter, then use eval to reverse
237
+ # that process (while maintaining the separation between arguments), and wrap
238
+ # the whole thing up as a single "set" statement.
239
+ #
240
+ # This will of course break if any of these variables contains a newline or
241
+ # an unmatched quote.
242
+ #
243
+
244
+ eval "set -- $(
245
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $EZ_CODEGEN_OPTS" |
246
+ xargs -n1 |
247
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248
+ tr '\n' ' '
249
+ )" '"$@"'
250
+
251
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,94 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+ @rem SPDX-License-Identifier: Apache-2.0
17
+ @rem
18
+
19
+ @if "%DEBUG%"=="" @echo off
20
+ @rem ##########################################################################
21
+ @rem
22
+ @rem ez-codegen startup script for Windows
23
+ @rem
24
+ @rem ##########################################################################
25
+
26
+ @rem Set local scope for the variables with windows NT shell
27
+ if "%OS%"=="Windows_NT" setlocal
28
+
29
+ set DIRNAME=%~dp0
30
+ if "%DIRNAME%"=="" set DIRNAME=.
31
+ @rem This is normally unused
32
+ set APP_BASE_NAME=%~n0
33
+ set APP_HOME=%DIRNAME%..
34
+
35
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37
+
38
+ @rem Add default JVM options here. You can also use JAVA_OPTS and EZ_CODEGEN_OPTS to pass JVM options to this script.
39
+ set DEFAULT_JVM_OPTS=
40
+
41
+ @rem Find java.exe
42
+ if defined JAVA_HOME goto findJavaFromJavaHome
43
+
44
+ set JAVA_EXE=java.exe
45
+ %JAVA_EXE% -version >NUL 2>&1
46
+ if %ERRORLEVEL% equ 0 goto execute
47
+
48
+ echo. 1>&2
49
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50
+ echo. 1>&2
51
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52
+ echo location of your Java installation. 1>&2
53
+
54
+ goto fail
55
+
56
+ :findJavaFromJavaHome
57
+ set JAVA_HOME=%JAVA_HOME:"=%
58
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59
+
60
+ if exist "%JAVA_EXE%" goto execute
61
+
62
+ echo. 1>&2
63
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64
+ echo. 1>&2
65
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66
+ echo location of your Java installation. 1>&2
67
+
68
+ goto fail
69
+
70
+ :execute
71
+ @rem Setup the command line
72
+
73
+ set CLASSPATH=%APP_HOME%\lib\ez-codegen-3.0.0.jar;%APP_HOME%\lib\kotlin-reflect-2.1.20.jar;%APP_HOME%\lib\kaml-jvm-0.77.0.jar;%APP_HOME%\lib\okhttp-4.12.0.jar;%APP_HOME%\lib\kotlin-stdlib-jdk8-1.8.21.jar;%APP_HOME%\lib\kotlinx-serialization-json-jvm-1.7.3.jar;%APP_HOME%\lib\kotlinx-serialization-core-jvm-1.7.3.jar;%APP_HOME%\lib\snakeyaml-engine-kmp-jvm-3.1.1.jar;%APP_HOME%\lib\okio-jvm-3.11.0.jar;%APP_HOME%\lib\kotlin-stdlib-jdk7-1.8.21.jar;%APP_HOME%\lib\urlencoder-lib-jvm-1.6.0.jar;%APP_HOME%\lib\kotlin-stdlib-2.1.20.jar;%APP_HOME%\lib\jcommander-1.82.jar;%APP_HOME%\lib\annotations-13.0.jar
74
+
75
+
76
+ @rem Execute ez-codegen
77
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %EZ_CODEGEN_OPTS% -classpath "%CLASSPATH%" MainKt %*
78
+
79
+ :end
80
+ @rem End local scope for the variables with windows NT shell
81
+ if %ERRORLEVEL% equ 0 goto mainEnd
82
+
83
+ :fail
84
+ rem Set variable EZ_CODEGEN_EXIT_CONSOLE if you need the _script_ return code instead of
85
+ rem the _cmd.exe /c_ return code!
86
+ set EXIT_CODE=%ERRORLEVEL%
87
+ if %EXIT_CODE% equ 0 set EXIT_CODE=1
88
+ if not ""=="%EZ_CODEGEN_EXIT_CONSOLE%" exit %EXIT_CODE%
89
+ exit /b %EXIT_CODE%
90
+
91
+ :mainEnd
92
+ if "%OS%"=="Windows_NT" endlocal
93
+
94
+ :omega
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: ez-code-generator
3
+ Version: 3.0.0
4
+ Summary: Console tool for generating API clients, data classes and validators
5
+ Author-email: Artem Vasilev <art@force.fm>
6
+ License-Expression: MIT
7
+ Project-URL: repository, https://github.com/atten/ez-code-generator
8
+ Keywords: codegen,swagger,openapi
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Kotlin
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Code Generators
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENCE
22
+ Dynamic: license-file
23
+
24
+ # Easy Code Generator
25
+
26
+ [![pipeline](https://gitlab.com/atten0/ez-code-generator/badges/master/pipeline.svg)](https://gitlab.com/atten0/ez-code-generator/-/pipelines)
27
+ [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg)](http://www.jacoco.org/jacoco)
28
+
29
+ Console tool for generating API clients, data classes and validators. Written in Kotlin, produces Kotlin and Python code. For the input it takes OpenApi document (JSON/YAML, v2.0 ‒ v3.1.0) or custom codegen schema (JSON).
30
+
31
+ The main goal of this project is to reduce integration costs between teams in multi-service environments.
32
+
33
+ ### Example
34
+
35
+ <table>
36
+ <tr>
37
+ <td> OpenAPI source YAML </td>
38
+ <td>
39
+
40
+ ```yaml
41
+ definitions:
42
+ BasicDto:
43
+ type: object
44
+ properties:
45
+ a:
46
+ title: Some integer
47
+ description: Field description
48
+ type: integer
49
+ maximum: 255
50
+ minimum: 0
51
+ b:
52
+ title: Timestamp
53
+ type: string
54
+ format: date-time
55
+ c:
56
+ title: Some enum
57
+ type: string
58
+ enum:
59
+ - variant1
60
+ - variant2
61
+ - variant3
62
+ default: variant1
63
+ required:
64
+ - a
65
+ ```
66
+
67
+ </td>
68
+ </tr>
69
+ <tr>
70
+ <td> Python generated dataclass </td>
71
+ <td>
72
+
73
+ ```python
74
+ @dataclass
75
+ class BasicDto:
76
+ # Field description
77
+ a: int = field()
78
+ b: t.Optional[datetime] = None
79
+ c: t.Optional[str] = "variant1"
80
+ ```
81
+
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <td> Kotlin generated classes </td>
86
+ <td>
87
+
88
+ ```kotlin
89
+ @Serializable
90
+ enum class SomeEnum(val value: String) {
91
+ @SerialName("variant1")
92
+ VARIANT_1("variant1"),
93
+ @SerialName("variant2")
94
+ VARIANT_2("variant2"),
95
+ @SerialName("variant3")
96
+ VARIANT_3("variant3"),
97
+ }
98
+
99
+ @Serializable
100
+ data class BasicDto(
101
+ // Field description
102
+ val a: Int,
103
+ @Contextual
104
+ val b: Instant? = null,
105
+ val c: SomeEnum? = SomeEnum.VARIANT_1,
106
+ )
107
+ ```
108
+
109
+ </td>
110
+ </tr>
111
+ </table>
112
+
113
+ > More examples: section [Available generators](#available-generators) below
114
+
115
+ ### Features
116
+
117
+ - Several python frameworks support (asyncio, django, pure dataclass etc);
118
+ - Schema validation, logging, error handling, retries and sessions within generated client out-of-the-box;
119
+ - Streamed dump/load (ijson);
120
+ - Kotlin experimental support.
121
+
122
+ ### Key differences
123
+
124
+ *ez-code-generator* is similar to [openapi-generator](https://github.com/openapitools/openapi-generator) except a major aspect: **a single output file instead of a package**.
125
+ It is meant to be straightforward and concise. No extra configuration options, no tricky preparations before use.
126
+ Just install dependencies, import generated client class and instantiate it. Then call API methods which take and return generated DTOs:
127
+
128
+ ```python
129
+ from client_generated import AllConstantsCollection as consts
130
+ from client_generated import AllDataclassesCollection as dto
131
+ from client_generated import RestApi
132
+
133
+ client = RestApi('https://example.com/v1/')
134
+ item = client.get_item(a=10)
135
+
136
+ # item = BasicDto(a=10, b=None, c="variant1")
137
+ ```
138
+
139
+ ### Common use cases
140
+
141
+ - Write integration code in agile, fast-moving projects;
142
+ - Use code generation in CI;
143
+ - Track API changes and check them for backward compatibility on both sides (client/server);
144
+ - Build ETL pipelines with transparent interfaces;
145
+ - Unify type declarations across languages.
146
+
147
+ ## Install
148
+
149
+ ### Docker image
150
+
151
+ ```
152
+ docker image pull registry.gitlab.com/atten0/ez-code-generator:master
153
+ ```
154
+
155
+ [Other image versions](https://gitlab.com/atten0/ez-code-generator/container_registry/1706585)
156
+
157
+ ### JAR
158
+
159
+ Requires: Java 11
160
+
161
+ Download and extract archive into current dir:
162
+
163
+ ```shell
164
+ wget -qO- https://github.com/atten/ez-code-generator/releases/download/v3.0.0/ez-codegen-3.0.0.zip | busybox unzip -
165
+ cd ez-codegen-3.0.0/bin/
166
+ chmod +x ez-codegen
167
+ ```
168
+
169
+ Other versions: [Gitlab](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/build/distributions/?job=publish-distro) | [Github](https://github.com/atten/ez-code-generator/releases)
170
+
171
+ ### Python package
172
+
173
+ Requires: Java 11, Python3
174
+
175
+ ```shell
176
+ pip install ez-code-generator==3.0.0
177
+ ```
178
+
179
+ Other versions: [PYPI](https://pypi.org/project/ez-code-generator/#history)
180
+
181
+ ### Build from source
182
+
183
+ ```shell
184
+ make build
185
+ ```
186
+
187
+ ## Usage
188
+
189
+ ez-codegen [options] <files/directories/urls...>
190
+
191
+ Using python package:
192
+
193
+ python -m ez-codegen [options] <files/directories/urls...>
194
+
195
+ Options:
196
+
197
+ * -t, --target
198
+ Target implementation
199
+ Possible Values: [KT_DATACLASS, KT_SERIALIZABLE_DATACLASS, KT_INTERFACE, PY_DJANGO_MODEL, PY_API_CLIENT, PY_API_ASYNC_CLIENT, PY_AMQP_BLOCKING_CLIENT, PY_AMQP_GEVENT_CLIENT, PY_MARSHMALLOW_DATACLASS, PY_DATACLASS]
200
+
201
+ -n, --name
202
+ Generated class name (inferred from input files if not specified)
203
+ Default: <empty string>
204
+
205
+ --include-url-path
206
+ Include only paths containing given strings
207
+ Default: []
208
+
209
+ --exclude-url-path
210
+ Do not include paths containing given strings
211
+ Default: []
212
+
213
+ -p, --prefixed
214
+ If enabled, add prefix to all fields
215
+ Default: false
216
+
217
+ --help
218
+ Show help usage and exit
219
+
220
+ --version, -v
221
+ Display version and exit
222
+
223
+ ## Basic guide
224
+
225
+ ### Script for python API client generation from OpenApi
226
+
227
+ Runs generator in docker container, reads OpenApi spec from URL and saves output to file.
228
+
229
+ ```shell
230
+ docker run --rm registry.gitlab.com/atten0/ez-code-generator:master \
231
+ https://gitlab.com/atten0/ez-code-generator/-/raw/master/src/test/resources/input/openApi.json \
232
+ -t PY_API_CLIENT \
233
+ > client_generated.py
234
+ ```
235
+
236
+ > Result: [client_generated.py](src/test/resources/org/codegen/generators/PyApiClientGenerator/endpointsOutput.py).
237
+
238
+ Usage examples: [test_clent.py](generatedCodeTests/PyApiClientGenerator/test_clent.py)
239
+
240
+ ## Available generators
241
+
242
+ | Target | Language/Framework | Serialization | Dependencies | Example output | Coverage |
243
+ |---------------------------|------------------------------|-----------------------|-----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
244
+ | KT_DATACLASS | Kotlin | kotlinx.serialization | | [entitiesOutput.kt](src/test/resources/org/codegen/generators/KtSerializableDataclassGenerator/entitiesOutput.kt) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-KtSerializableDataclassGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/KtSerializableDataclassGenerator/htmlcov?job=run-tests-KtSerializableDataclassGenerator) |
245
+ | KT_SERIALIZABLE_DATACLASS | Kotlin | Jackson | | [entitiesOutputJacksonEnabled.kt](src/test/resources/org/codegen/generators/KtSerializableDataclassGenerator/entitiesOutputJacksonEnabled.kt) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-KtSerializableDataclassGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/KtSerializableDataclassGenerator/htmlcov?job=run-tests-KtSerializableDataclassGenerator) |
246
+ | PY_API_CLIENT | Python (3.9 - 3.12) | Marshmallow | [requirements.txt](generatedCodeTests/PyApiClientGenerator/requirements.txt) | [endpointsOutput.py](src/test/resources/org/codegen/generators/PyApiClientGenerator/endpointsOutput.py) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-PyApiClientGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/PyApiClientGenerator/htmlcov?job=run-tests-PyApiClientGenerator) |
247
+ | PY_API_ASYNC_CLIENT | Python asyncio (3.9 - 3.12) | Marshmallow | [requirements.txt](generatedCodeTests/PyApiAsyncClientGenerator/requirements.txt) | [endpointsOutput.py](src/test/resources/org/codegen/generators/PyApiAsyncClientGenerator/endpointsOutput.py) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-PyApiAsyncClientGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/PyApiAsyncClientGenerator/htmlcov?job=run-tests-PyApiAsyncClientGenerator) |
248
+ | PY_DATACLASS | Python (3.9 - 3.12) | Dataclass | - | [entitiesOutput.py](src/test/resources/org/codegen/generators/PyDataclassGenerator/entitiesOutput.py) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-PyDataclassGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/PyDataclassGenerator/htmlcov?job=run-tests-PyDataclassGenerator) |
249
+ | PY_MARSHMALLOW_DATACLASS | Python (3.9 - 3.12) | Marshmallow | [requirements.txt](generatedCodeTests/PyMarshmallowDataclassGenerator/requirements.txt) | [entitiesOutput.py](src/test/resources/org/codegen/generators/PyMarshmallowDataclassGenerator/entitiesOutput.py) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-PyMarshmallowDataclassGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/PyMarshmallowDataclassGenerator/htmlcov?job=run-tests-PyMarshmallowDataclassGenerator) |
250
+ | PY_DJANGO_MODEL | Python (3.9 - 3.12) + Django | - | [requirements.txt](generatedCodeTests/PyDjangoModelGenerator/requirements.txt) | [entitiesOutput.py](src/test/resources/org/codegen/generators/PyDjangoModelGenerator/entitiesOutput.py) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-PyDjangoModelGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/PyDjangoModelGenerator/app/migrations?job=run-tests-PyDjangoModelGenerator) |
251
+ | PY_AMQP_BLOCKING_CLIENT | Python3 | Marshmallow | | [endpointsOutput.py](src/test/resources/org/codegen/generators/PyAmqpBlockingClientGenerator/endpointsOutput.py) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-PyAmqpBlockingClientGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/PyAmqpBlockingClientGenerator/htmlcov?job=run-tests-PyAmqpBlockingClientGenerator) |
252
+ | PY_AMQP_GEVENT_CLIENT | Python3 + Gevent | Marshmallow | | [endpointsOutput.py](src/test/resources/org/codegen/generators/PyAmqpGeventClientGenerator/endpointsOutput.py) | [![coverage](https://gitlab.com/atten0/ez-code-generator/badges/master/coverage.svg?job=run-tests-PyAmqpGeventClientGenerator)](https://gitlab.com/atten0/ez-code-generator/-/jobs/artifacts/master/browse/generatedCodeTests/PyAmqpGeventClientGenerator/htmlcov?job=run-tests-PyAmqpGeventClientGenerator) |
253
+
254
+ ## Support and feedback
255
+
256
+ For usage questions, feature proposals and bug reports: [github issues page](https://github.com/atten/ez-code-generator/issues).
257
+
258
+ For other matters: [author's profile with contacts](https://github.com/atten).
@@ -0,0 +1,22 @@
1
+ ez-codegen/__main__.py,sha256=SKT8SFFIKwQNW2snwZEYl3K6arjiwAku6hQgALlcozk,222
2
+ ez-codegen/bin/ez-codegen,sha256=0DsYoHKnrrmOpyQFXvFTI11fDcg7Cm6bfVmyxXcvDRA,9220
3
+ ez-codegen/bin/ez-codegen.bat,sha256=kz6UN1rwYJj687eCGgg1WqaVZmJfVEtm13B53VowTQU,3447
4
+ ez-codegen/lib/annotations-13.0.jar,sha256=rOKhDcji1f00kl7KwD5JiLLA-FFlDJS4zvSbob0RFHg,17536
5
+ ez-codegen/lib/ez-codegen-3.0.0.jar,sha256=_oSxIj3sryyK0YFmjYkoaWB650yXaILLgIIXFNT1lzo,305544
6
+ ez-codegen/lib/jcommander-1.82.jar,sha256=3urBV8jeaCKHjYXQx7yEZ6GcyEhNN3iPeATwOd3igLE,88407
7
+ ez-codegen/lib/kaml-jvm-0.77.0.jar,sha256=V35ly4ZpGFICJAjm4fXERNttzBSXyNx4Fs2Pl8wxfFM,196947
8
+ ez-codegen/lib/kotlin-reflect-2.1.20.jar,sha256=QZd48reoJrrW7iyh5L3r5jmrMG0pBPo-8qMI7PqrOBE,3081304
9
+ ez-codegen/lib/kotlin-stdlib-2.1.20.jar,sha256=G8x06M6E4sJeqv3hDxJINJzOMGK242l4y-7GENsekwo,1724057
10
+ ez-codegen/lib/kotlin-stdlib-jdk7-1.8.21.jar,sha256=M9FI2w4R3r0NkGd9KCQrztkH-cd3MAAP1ZeGcIkDnYY,963
11
+ ez-codegen/lib/kotlin-stdlib-jdk8-1.8.21.jar,sha256=PbdSowB08G7mxXmEqm8n2kT00rvH9UQmUfaYjxyyt9c,968
12
+ ez-codegen/lib/kotlinx-serialization-core-jvm-1.7.3.jar,sha256=8K3eRYZBREdThc9Kp-C3_rJ_Yfz5RyZl7ZjMlxsGses,390987
13
+ ez-codegen/lib/kotlinx-serialization-json-jvm-1.7.3.jar,sha256=sekThJntjSA3Xt2j8rHJXzEDoljv9q-e3F6gcQDyspw,270553
14
+ ez-codegen/lib/okhttp-4.12.0.jar,sha256=sQUAgbFLt6On5VpNPvAbXc-rxFO0VzpPwBl2cZHV9OA,789531
15
+ ez-codegen/lib/okio-jvm-3.11.0.jar,sha256=LSJUGhkvkBpFyVJ0Vn1pV6we1hPUnkHbTl5dhhOc8CI,365608
16
+ ez-codegen/lib/snakeyaml-engine-kmp-jvm-3.1.1.jar,sha256=cz4TR-PskJ6KfuGZ5Ipk0BgFaUYbO8CMimuxM19c4b0,444908
17
+ ez-codegen/lib/urlencoder-lib-jvm-1.6.0.jar,sha256=jQ_SrrSNGdxJxWPrwA8nSUfkX3FsEHU1wS6tY97NaI0,6512
18
+ ez_code_generator-3.0.0.dist-info/licenses/LICENCE,sha256=pXslRL2Z1J50W-vOXm7uR8EyRGaBABA1Kd1uRPG0dRA,1070
19
+ ez_code_generator-3.0.0.dist-info/METADATA,sha256=uLPIkbs0VeJGb7R4XihzfrTpbMCbp6xuPG_MLUL6xqo,13805
20
+ ez_code_generator-3.0.0.dist-info/WHEEL,sha256=A8Eltl-h0W-qZDVezsLjjslosEH_pdYC2lQ0JcbgCzs,91
21
+ ez_code_generator-3.0.0.dist-info/top_level.txt,sha256=WkxR7O-Dep_pKZPfZJyuBFINSdEneSyvPNzp31hR6_g,11
22
+ ez_code_generator-3.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.7.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Artem Vasilev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ ez-codegen