@team-supercharge/oasg 4.0.2 → 4.1.0
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.
- package/CHANGELOG.md +8 -0
- package/README.md +20 -0
- package/bin/oasg +13 -2
- package/config.schema.yml +15 -0
- package/package.json +1 -1
- package/targets/python/generate.sh +21 -0
- package/targets/python/generator-config.json +3 -0
- package/targets/python/publish.sh +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [4.1.0](https://gitlab.com/team-supercharge/oasg/compare/v4.0.2...v4.1.0) (2022-03-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add the ability to setup default generator version by target ([0abbc90](https://gitlab.com/team-supercharge/oasg/commit/0abbc90ba0d4af97c577d76ca1f451f825e3a77f))
|
|
11
|
+
* introduce python client generation ([a23e77d](https://gitlab.com/team-supercharge/oasg/commit/a23e77dc9fbf8182e5aac3190a1bcdb28c55a598))
|
|
12
|
+
|
|
5
13
|
### [4.0.2](https://gitlab.com/team-supercharge/oasg/compare/v4.0.1...v4.0.2) (2022-03-21)
|
|
6
14
|
|
|
7
15
|
|
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Design APIs in OpenAPI 3.0 format, lint them, and generate client/server package
|
|
|
27
27
|
* [Spring](#spring)
|
|
28
28
|
* [Android](#android)
|
|
29
29
|
* [iOS](#iOS)
|
|
30
|
+
* [Python](#python)
|
|
30
31
|
* [Migration Guide](#migration-guide)
|
|
31
32
|
* [Roadmap](#roadmap)
|
|
32
33
|
|
|
@@ -400,6 +401,25 @@ Common target parameters
|
|
|
400
401
|
| podRepository | The public SC pod repository where the specification is stored | Y | - |
|
|
401
402
|
| repository | URL of the generated client api code repository | Y | - |
|
|
402
403
|
|
|
404
|
+
#### Python
|
|
405
|
+
|
|
406
|
+
```json
|
|
407
|
+
{
|
|
408
|
+
"id": "client-python",
|
|
409
|
+
"type": "python",
|
|
410
|
+
"source": "source-merged",
|
|
411
|
+
"packageName": "oasg_example",
|
|
412
|
+
"repositoryUrl": "https://gitlab.supercharge.io/api/v4/projects/1226/packages/pypi"
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
|Parameter| Description| Required | Default |
|
|
417
|
+
|-|-|-|-|
|
|
418
|
+
| packageName | Package nem for the project (convention: snake_case) | Y | - |
|
|
419
|
+
| repositoryUrl | URL of the PyPI repository | Y | - |
|
|
420
|
+
|
|
421
|
+
Publishing the PyPI packages is done with Twine. For authentication againts the PiPI repository you need to set the `TWINE_USERNAME` and `TWINE_PASSWORD` environment variables.
|
|
422
|
+
|
|
403
423
|
## Migration Guide
|
|
404
424
|
|
|
405
425
|
This section covers the breaking changes and their migrations across major version upgrades.
|
package/bin/oasg
CHANGED
|
@@ -23,7 +23,17 @@ const REQUIRED_COMMANDS = ['java', 'wget', 'jq'];
|
|
|
23
23
|
const SERVE_PORT = '8888';
|
|
24
24
|
const PROXY_PORT = '9999';
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const DEFAULT_GENERATOR_VERSION_MAPPING = {
|
|
27
|
+
"android": '4.3.1',
|
|
28
|
+
"ios": '4.3.1',
|
|
29
|
+
"react-native": '4.3.1',
|
|
30
|
+
"angular": '4.3.1',
|
|
31
|
+
"spring": '4.3.1',
|
|
32
|
+
"spring-kotlin": '4.3.1',
|
|
33
|
+
"stubby": '4.3.1',
|
|
34
|
+
"feign": '4.3.1',
|
|
35
|
+
"python": '5.4.0' // python generation does not work with 4.3.1
|
|
36
|
+
};
|
|
27
37
|
const DEFAULT_KTLINT_VERSION = '0.39.0';
|
|
28
38
|
const BIN_FOLDER = 'out/.bin';
|
|
29
39
|
|
|
@@ -42,6 +52,7 @@ const DEFAULT_GENERATOR_ID_MAPPING = {
|
|
|
42
52
|
"spring-kotlin": 'kotlin-spring',
|
|
43
53
|
"stubby": 'stubby',
|
|
44
54
|
"feign": 'spring',
|
|
55
|
+
"python": 'python'
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
let config;
|
|
@@ -175,7 +186,7 @@ async function parseConfig() {
|
|
|
175
186
|
// set default generator values to targets with undefined
|
|
176
187
|
config.targets.forEach(t => {
|
|
177
188
|
if (!t.generator) {
|
|
178
|
-
t.generator =
|
|
189
|
+
t.generator = DEFAULT_GENERATOR_VERSION_MAPPING[t.type];
|
|
179
190
|
}
|
|
180
191
|
if (!t.generatorId) {
|
|
181
192
|
if (t.type in DEFAULT_GENERATOR_ID_MAPPING) {
|
package/config.schema.yml
CHANGED
|
@@ -18,6 +18,7 @@ properties:
|
|
|
18
18
|
- $ref: '#/targets/Stubby'
|
|
19
19
|
- $ref: '#/targets/Android'
|
|
20
20
|
- $ref: '#/targets/ios'
|
|
21
|
+
- $ref: '#/targets/Python'
|
|
21
22
|
required:
|
|
22
23
|
- targets
|
|
23
24
|
additionalProperties: false
|
|
@@ -232,6 +233,20 @@ targets:
|
|
|
232
233
|
- repository
|
|
233
234
|
- podRepository
|
|
234
235
|
|
|
236
|
+
Python:
|
|
237
|
+
allOf:
|
|
238
|
+
- $ref: '#/targets/Base'
|
|
239
|
+
- properties:
|
|
240
|
+
type:
|
|
241
|
+
pattern: "^python$"
|
|
242
|
+
packageName:
|
|
243
|
+
type: string
|
|
244
|
+
repositoryUrl:
|
|
245
|
+
type: string
|
|
246
|
+
required:
|
|
247
|
+
- packageName
|
|
248
|
+
- repositoryUrl
|
|
249
|
+
|
|
235
250
|
definitions:
|
|
236
251
|
# default
|
|
237
252
|
SourceOverrides:
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#/bin/bash
|
|
2
|
+
|
|
3
|
+
source $(dirname "$0")/../common.sh
|
|
4
|
+
|
|
5
|
+
# change npm pre-release syntax (with - after semver) to python local syntax (with + after semver)
|
|
6
|
+
version=$(echo $version | sed 's/-/\+/')
|
|
7
|
+
echo "[NOTE] version updated to: ${version}"
|
|
8
|
+
|
|
9
|
+
rm -rf out/$targetId
|
|
10
|
+
mkdir -p out/$targetId
|
|
11
|
+
|
|
12
|
+
java -jar $binary generate \
|
|
13
|
+
-g $generatorId \
|
|
14
|
+
-i $openApiFile \
|
|
15
|
+
-o out/$targetId \
|
|
16
|
+
-c $(dirname "$0")/generator-config.json \
|
|
17
|
+
-p "packageVersion=$version,packageName=$packageName" $generatorCustomArgs
|
|
18
|
+
|
|
19
|
+
cd out/$targetId
|
|
20
|
+
python3 setup.py sdist bdist_wheel
|
|
21
|
+
cd ../../
|