@team-supercharge/oasg 16.1.0 → 16.3.0-feature-aspdotnetcore-generator-f6a57a17.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/README.md +41 -0
- package/bin/merger.js +5 -1
- package/bin/oasg +3 -1
- package/bin/process-source.js +31 -1
- package/config.schema.yml +33 -0
- package/package.json +1 -1
- package/targets/aspdotnetcore/generate.sh +15 -0
- package/targets/aspdotnetcore/generator-config.json +23 -0
- package/targets/aspdotnetcore/publish.sh +23 -0
- package/targets/python/generate.sh +25 -0
- package/targets/python/generator-config.json +8 -0
- package/targets/python/publish.sh +7 -0
package/README.md
CHANGED
@@ -121,6 +121,7 @@ The table below gives an overview of the changes (breaking, non-breaking, bug fi
|
|
121
121
|
| `flutter` |➖ |➖ |➖ |🆕 |
|
122
122
|
| `ios` |➖ |➖ |➖ |💥 |🐛 |➖ |➖ |➖ |✨ |➖ |💥 |➖ |➖ |✨ |🆕 |
|
123
123
|
| `kmp` |➖ |➖ |🆕 |
|
124
|
+
| `python` |🆕 |
|
124
125
|
| `python-legacy` |💥 |➖ |🐛 |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
125
126
|
| `react` |➖ |🐛 |➖ |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
126
127
|
| `typescript-axios` |🆕 |
|
@@ -724,6 +725,25 @@ TBD
|
|
724
725
|
| formatterCustomArgs | Custom arguments of the `ktlint` formatter | N | --disabled_rules=no-wildcard-imports,max-line-length,enum-entry-name-case |
|
725
726
|
| repository | URL of the Maven Repository | N | - |
|
726
727
|
|
728
|
+
#### `python`
|
729
|
+
|
730
|
+
```json
|
731
|
+
{
|
732
|
+
"id": "client-python",
|
733
|
+
"type": "python",
|
734
|
+
"source": "source-merged",
|
735
|
+
"packageName": "oasg_example",
|
736
|
+
"repositoryUrl": "https://gitlab.supercharge.io/api/v4/projects/1226/packages/pypi"
|
737
|
+
}
|
738
|
+
```
|
739
|
+
|
740
|
+
|Parameter| Description| Required | Default |
|
741
|
+
|-|-|-|-|
|
742
|
+
| packageName | Package nem for the project (convention: snake_case) | Y | - |
|
743
|
+
| repositoryUrl | URL of the PyPI repository | Y | - |
|
744
|
+
|
745
|
+
Publishing the PyPI packages is done with Twine. For authentication against the PiPI repository you need to set the `TWINE_USERNAME` and `TWINE_PASSWORD` environment variables.
|
746
|
+
|
727
747
|
#### `python-legacy`
|
728
748
|
|
729
749
|
```json
|
@@ -986,6 +1006,27 @@ Validations from OpenAPI spec:
|
|
986
1006
|
| packageName | Name of the generated package | Y | - |
|
987
1007
|
| generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
|
988
1008
|
|
1009
|
+
#### `dotnet-webapi`
|
1010
|
+
|
1011
|
+
```json
|
1012
|
+
{
|
1013
|
+
"id": "dotnet-webapi",
|
1014
|
+
"type": "dotnet-webapi",
|
1015
|
+
"source": "source-merged",
|
1016
|
+
"sourceUrl": "https://api.nuget.org/v3/index.json",
|
1017
|
+
"apiKey": "apiKey",
|
1018
|
+
"packageName": "packageName",
|
1019
|
+
"generatorCustomArgs": "--global-property=supportingFiles,modelDocs --additional-properties=nullableReferenceTypes=false"
|
1020
|
+
}
|
1021
|
+
```
|
1022
|
+
|
1023
|
+
| Parameter | Description | Required | Default |
|
1024
|
+
| ------------------- | ------------------------------------------------------------------------------ | -------- | ------- |
|
1025
|
+
| sourceUrl | Url to where the package will be published | Y | - |
|
1026
|
+
| apiKey | Api key of nuget source | Y | - |
|
1027
|
+
| packageName | Name of the generated package | Y | - |
|
1028
|
+
| generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
|
1029
|
+
|
989
1030
|
#### `postman`
|
990
1031
|
|
991
1032
|
```json
|
package/bin/merger.js
CHANGED
@@ -181,12 +181,16 @@ function updateReferences(document, oldValue, newValue) {
|
|
181
181
|
|
182
182
|
function mergeDocument(leftDoc, rightDoc) {
|
183
183
|
// not overriding: info, externalDocs (always from first file)
|
184
|
-
// not merging: servers,
|
184
|
+
// not merging: servers, security
|
185
185
|
|
186
186
|
// paths
|
187
187
|
const mergedPaths = { ...leftDoc.paths, ...rightDoc.paths };
|
188
188
|
leftDoc.paths = mergedPaths;
|
189
189
|
|
190
|
+
// webhooks
|
191
|
+
const mergedWebhooks = { ...leftDoc.webhooks, ...rightDoc.webhooks };
|
192
|
+
leftDoc.webhooks = mergedWebhooks;
|
193
|
+
|
190
194
|
// components
|
191
195
|
const mergedSchemas = { ...leftDoc.components.schemas, ...rightDoc.components.schemas };
|
192
196
|
const mergedResponses = { ...leftDoc.components.responses, ...rightDoc.components.responses };
|
package/bin/oasg
CHANGED
@@ -36,12 +36,13 @@ const PROXY_PORT = '9999';
|
|
36
36
|
const DEFAULT_GENERATOR_MAPPING = {
|
37
37
|
// client targets
|
38
38
|
"android": { version: '7.0.1', generator: 'kotlin' },
|
39
|
-
"angular": { version: '7.0
|
39
|
+
"angular": { version: '7.11.0', generator: 'typescript-angular' },
|
40
40
|
"feign": { version: '7.0.1', generator: 'spring' },
|
41
41
|
"feign-kotlin": { version: '7.0.1', generator: 'kotlin-spring' },
|
42
42
|
"flutter": { version: '7.0.1', generator: 'dart-dio' },
|
43
43
|
"ios": { version: '7.0.1', generator: 'swift5' },
|
44
44
|
"kmp": { version: '7.8.0', generator: 'kotlin' },
|
45
|
+
"python": { version: '7.11.0', generator: 'python' },
|
45
46
|
"python-legacy": { version: '7.11.0', generator: 'python-pydantic-v1' },
|
46
47
|
"react": { version: '7.0.1', generator: 'typescript-fetch' },
|
47
48
|
"typescript-axios": { version: '7.11.0', generator: 'typescript-axios' },
|
@@ -53,6 +54,7 @@ const DEFAULT_GENERATOR_MAPPING = {
|
|
53
54
|
"python-fastapi": { version: '7.8.0', generator: 'python-fastapi' },
|
54
55
|
"python-fastapi-raw-request": { version: '7.0.1', generator: 'python-fastapi' },
|
55
56
|
"dotnet": { version: '7.8.0', generator: 'csharp-functions' },
|
57
|
+
"dotnet-webapi": { version: '7.8.0', generator: 'aspnetcore' },
|
56
58
|
// misc targets
|
57
59
|
"contract-testing": { version: '4.3.1', generator: 'typescript-node' },
|
58
60
|
"openapi": { version: undefined, generator: undefined },
|
package/bin/process-source.js
CHANGED
@@ -69,13 +69,14 @@ async function processSource(source, sourceFile, version) {
|
|
69
69
|
// clean up unused things
|
70
70
|
if (source.cleanup) {
|
71
71
|
const removedPaths = [];
|
72
|
+
const removedWebhooks = [];
|
72
73
|
const removedTags = [];
|
73
74
|
const usedTags = [];
|
74
75
|
|
75
76
|
// remove empty paths & gather tags
|
76
77
|
const paths = document.paths || {};
|
77
78
|
for (const pathKey in paths) {
|
78
|
-
const path =
|
79
|
+
const path = paths[pathKey];
|
79
80
|
|
80
81
|
if (Object.keys(path).length === 0) {
|
81
82
|
removedPaths.push(pathKey);
|
@@ -97,10 +98,39 @@ async function processSource(source, sourceFile, version) {
|
|
97
98
|
}
|
98
99
|
}
|
99
100
|
|
101
|
+
// remove empty webhooks & gather tags
|
102
|
+
const webhooks = document.webhooks || {};
|
103
|
+
for (const webhookKey in webhooks) {
|
104
|
+
const webhook = webhooks[webhookKey];
|
105
|
+
|
106
|
+
if (Object.keys(webhook).length === 0) {
|
107
|
+
removedWebhooks.push(webhookKey);
|
108
|
+
delete webhooks[webhookKey];
|
109
|
+
}
|
110
|
+
|
111
|
+
for (const methodKey in webhook) {
|
112
|
+
const maybeOperation = webhook[methodKey];
|
113
|
+
|
114
|
+
if (!maybeOperation.tags) {
|
115
|
+
continue;
|
116
|
+
}
|
117
|
+
|
118
|
+
maybeOperation.tags.forEach(tag => {
|
119
|
+
if (!usedTags.includes(tag)) {
|
120
|
+
usedTags.push(tag);
|
121
|
+
}
|
122
|
+
});
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
100
126
|
if (removedPaths.length !== 0) {
|
101
127
|
console.log(`cleaned up unused paths:\n ${removedPaths.join('\n ')}`);
|
102
128
|
}
|
103
129
|
|
130
|
+
if (removedWebhooks.length !== 0) {
|
131
|
+
console.log(`cleaned up unused webhooks:\n ${removedWebhooks.join('\n ')}`);
|
132
|
+
}
|
133
|
+
|
104
134
|
// remouve unused tags
|
105
135
|
const tags = [...document.tags];
|
106
136
|
tags.forEach(tag => {
|
package/config.schema.yml
CHANGED
@@ -19,6 +19,7 @@ properties:
|
|
19
19
|
- $ref: '#/targets/Stubby'
|
20
20
|
- $ref: '#/targets/Android'
|
21
21
|
- $ref: '#/targets/ios'
|
22
|
+
- $ref: '#/targets/Python'
|
22
23
|
- $ref: '#/targets/PythonLegacy'
|
23
24
|
- $ref: '#/targets/PythonFastApi'
|
24
25
|
- $ref: '#/targets/PythonFastApiRawRequest'
|
@@ -28,6 +29,7 @@ properties:
|
|
28
29
|
- $ref: '#/targets/Flutter'
|
29
30
|
- $ref: '#/targets/Kmp'
|
30
31
|
- $ref: '#/targets/Dotnet'
|
32
|
+
- $ref: '#/targets/DotnetWebApi'
|
31
33
|
- $ref: '#/targets/Postman'
|
32
34
|
- $ref: '#/targets/TypeScriptAxios'
|
33
35
|
- $ref: '#/targets/TypeScriptFetch'
|
@@ -288,6 +290,20 @@ targets:
|
|
288
290
|
- repository
|
289
291
|
- interfaceType
|
290
292
|
|
293
|
+
Python:
|
294
|
+
allOf:
|
295
|
+
- $ref: '#/targets/Base'
|
296
|
+
- properties:
|
297
|
+
type:
|
298
|
+
pattern: "^python$"
|
299
|
+
packageName:
|
300
|
+
type: string
|
301
|
+
repositoryUrl:
|
302
|
+
type: string
|
303
|
+
required:
|
304
|
+
- packageName
|
305
|
+
- repositoryUrl
|
306
|
+
|
291
307
|
PythonLegacy:
|
292
308
|
allOf:
|
293
309
|
- $ref: '#/targets/Base'
|
@@ -398,6 +414,23 @@ targets:
|
|
398
414
|
- apiKey
|
399
415
|
- packageName
|
400
416
|
|
417
|
+
DotnetWebApi:
|
418
|
+
allOf:
|
419
|
+
- $ref: '#/targets/Base'
|
420
|
+
- properties:
|
421
|
+
type:
|
422
|
+
pattern: '^dotnet-webapi$'
|
423
|
+
sourceUrl:
|
424
|
+
type: string
|
425
|
+
apiKey:
|
426
|
+
type: string
|
427
|
+
packageName:
|
428
|
+
type: string
|
429
|
+
required:
|
430
|
+
- sourceUrl
|
431
|
+
- apiKey
|
432
|
+
- packageName
|
433
|
+
|
401
434
|
Kmp:
|
402
435
|
allOf:
|
403
436
|
- $ref: '#/targets/Base'
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@team-supercharge/oasg",
|
3
|
-
"version": "16.
|
3
|
+
"version": "16.3.0-feature-aspdotnetcore-generator-f6a57a17.0",
|
4
4
|
"description": "Node-based tool to lint OpenAPI documents and generate clients, servers and documentation from them",
|
5
5
|
"author": "Supercharge",
|
6
6
|
"license": "MIT",
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
source $(dirname "$0")/../common.sh
|
4
|
+
|
5
|
+
rm -rf out/$targetId
|
6
|
+
mkdir -p out/$targetId
|
7
|
+
|
8
|
+
java -jar $binary generate \
|
9
|
+
-g $generatorId \
|
10
|
+
-i $openApiFile \
|
11
|
+
-t $templateDir \
|
12
|
+
-o out/$targetId \
|
13
|
+
-c $(dirname "$0")/generator-config.json \
|
14
|
+
-p "packageVersion=$version,packageName=$packageName" \
|
15
|
+
$generatorCustomArgs
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"inlineSchemaOptions": {
|
3
|
+
"ARRAY_ITEM_SUFFIX": "",
|
4
|
+
"MAP_ITEM_SUFFIX": "",
|
5
|
+
"SKIP_SCHEMA_REUSE": "true"
|
6
|
+
},
|
7
|
+
"globalProperties": {
|
8
|
+
"models": "",
|
9
|
+
"supportingFiles": "",
|
10
|
+
"modelDocs": ""
|
11
|
+
},
|
12
|
+
"additionalProperties": {
|
13
|
+
"aspnetCoreVersion": "8.0",
|
14
|
+
"operationIsAsync": true,
|
15
|
+
"buildTarget": "library",
|
16
|
+
"generateBody": false,
|
17
|
+
"useDateTimeOffset": true,
|
18
|
+
"nullableReferenceTypes": true,
|
19
|
+
"operationResultTask": true,
|
20
|
+
"enumNameSuffix": "",
|
21
|
+
"enumValueSuffix": ""
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
source $(dirname "$0")/../common.sh
|
4
|
+
|
5
|
+
cd out/$targetId
|
6
|
+
|
7
|
+
# pack
|
8
|
+
dotnet restore
|
9
|
+
dotnet build -c Release
|
10
|
+
dotnet pack -c Release -p:Version=$version -p:IsPackable=true
|
11
|
+
|
12
|
+
isWindows=false
|
13
|
+
if [[ "$OSTYPE" == "cygwin"* ]] || [[ "$OSTYPE" == "msys"* ]]; then
|
14
|
+
isWindows=true
|
15
|
+
fi
|
16
|
+
storePasswordOption=$([[ $isWindows == true ]] && echo "" || echo "--store-password-in-clear-text")
|
17
|
+
|
18
|
+
# publish
|
19
|
+
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration></configuration>" > nuget.config
|
20
|
+
dotnet nuget add source "${sourceUrl}" -n Feed -u User -p "${apiKey}" --configfile nuget.config $storePasswordOption
|
21
|
+
dotnet nuget push "src/**/bin/Release/*.nupkg" -s ${sourceUrl} -k AZ
|
22
|
+
|
23
|
+
cd ../..
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#/bin/bash
|
2
|
+
|
3
|
+
source $(dirname "$0")/../common.sh
|
4
|
+
|
5
|
+
# if the version contains a `-` character, then use PEP 440 beta version syntax
|
6
|
+
# example: 1.0.0-beta.1 -> 1.0.0b0+beta.1
|
7
|
+
if [[ $version == *"-"* ]]; then
|
8
|
+
version=$(echo $version | sed 's/-/b0+/')
|
9
|
+
echo "[NOTE] version updated to: ${version}"
|
10
|
+
fi
|
11
|
+
|
12
|
+
rm -rf out/$targetId
|
13
|
+
mkdir -p out/$targetId
|
14
|
+
|
15
|
+
java -jar $binary generate \
|
16
|
+
-g $generatorId \
|
17
|
+
-i $openApiFile \
|
18
|
+
-t $templateDir \
|
19
|
+
-o out/$targetId \
|
20
|
+
-c $(dirname "$0")/generator-config.json \
|
21
|
+
-p "packageVersion=$version,packageName=$packageName" $generatorCustomArgs
|
22
|
+
|
23
|
+
cd out/$targetId
|
24
|
+
python3 setup.py sdist bdist_wheel
|
25
|
+
cd ../../
|