@team-supercharge/oasg 9.2.0 → 9.2.2
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/.gitlab-ci.yml +2 -2
- package/.nvmrc +1 -1
- package/CHANGELOG.md +21 -0
- package/Dockerfile +2 -1
- package/package.json +5 -1
- package/targets/angular/publish.sh +1 -4
- package/targets/nestjs/generate.sh +7 -11
- package/targets/nestjs/generator-config.json +9 -0
- package/targets/nestjs/templates/remove-empty-param-objects-from-context.js +18 -0
- package/targets/nestjs/templates/rewrite-http-annotations.js +24 -0
- package/targets/nestjs/templates/rewrite-path-parameters.js +19 -0
- package/targets/stubby/Dockerfile +1 -1
package/.gitlab-ci.yml
CHANGED
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v18.15.0
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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
|
+
### [9.2.2](https://gitlab.com/team-supercharge/oasg/compare/v9.2.1...v9.2.2) (2023-04-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **angular:** run the npm publish in the right folder ([be32f40](https://gitlab.com/team-supercharge/oasg/commit/be32f40fffbc3f6b080c98adcca809657165b4dc))
|
|
11
|
+
* explicitly install deps to Docker-embedded oasg ([fb83ece](https://gitlab.com/team-supercharge/oasg/commit/fb83ecea2c8756dab942284f014fdcd695529719))
|
|
12
|
+
|
|
13
|
+
### [9.2.1](https://gitlab.com/team-supercharge/oasg/compare/v9.2.0...v9.2.1) (2023-04-13)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **nestjs:** use node for post-processing files instead of sed ([22d996b](https://gitlab.com/team-supercharge/oasg/commit/22d996bd0c958108871bc8d331a44aa4f72f99b7))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### CI
|
|
22
|
+
|
|
23
|
+
* upgrade to latest jarvis ([c444628](https://gitlab.com/team-supercharge/oasg/commit/c4446285ce4a97e6fd75239be27cb08b054f9f68))
|
|
24
|
+
* use latest lts node version ([bdd39a6](https://gitlab.com/team-supercharge/oasg/commit/bdd39a663a5d8c1f37704c9ad0c12148dd217f6f))
|
|
25
|
+
|
|
5
26
|
## [9.2.0](https://gitlab.com/team-supercharge/oasg/compare/v9.1.1...v9.2.0) (2023-04-03)
|
|
6
27
|
|
|
7
28
|
|
package/Dockerfile
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-supercharge/oasg",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.2",
|
|
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",
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git@gitlab.com:team-supercharge/oasg/oasg.git"
|
|
14
14
|
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "^18",
|
|
17
|
+
"npm": "^9"
|
|
18
|
+
},
|
|
15
19
|
"dependencies": {
|
|
16
20
|
"@apidevtools/json-schema-ref-parser": "^9.0.6",
|
|
17
21
|
"@apidevtools/swagger-parser": "^10.0.2",
|
|
@@ -18,17 +18,13 @@ cd out/$targetId
|
|
|
18
18
|
# remove unnecessary files
|
|
19
19
|
rm -rf variables.ts configuration.ts api.module.ts encoder.ts ng-package.json
|
|
20
20
|
|
|
21
|
-
# rewrite http method
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
sed -i 's/^ \/\/\/\/ @put/ @Put/g' api/*.api.ts
|
|
25
|
-
sed -i 's/^ \/\/\/\/ @delete/ @Delete/g' api/*.api.ts
|
|
26
|
-
sed -i 's/^ \/\/\/\/ @patch/ @Patch/g' api/*.api.ts
|
|
27
|
-
sed -i 's/^ \/\/\/\/ @options/ @Options/g' api/*.api.ts
|
|
28
|
-
sed -i 's/^ \/\/\/\/ @head/ @Head/g' api/*.api.ts
|
|
21
|
+
# rewrite http method annotations
|
|
22
|
+
node rewrite-http-annotations.js
|
|
23
|
+
rm rewrite-http-annotations.js
|
|
29
24
|
|
|
30
25
|
# remove empty params objects from context objects
|
|
31
|
-
|
|
26
|
+
node remove-empty-param-objects-from-context.js
|
|
27
|
+
rm remove-empty-param-objects-from-context.js
|
|
32
28
|
|
|
33
29
|
# reorder operations (place ones with path params backwards)
|
|
34
30
|
node reorder-operations.js
|
|
@@ -38,8 +34,8 @@ rm reorder-operations.js
|
|
|
38
34
|
node unescape-patterns.js
|
|
39
35
|
rm unescape-patterns.js
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
node rewrite-path-parameters.js
|
|
38
|
+
rm rewrite-path-parameters.js
|
|
43
39
|
|
|
44
40
|
npm install
|
|
45
41
|
npm run build
|
|
@@ -23,6 +23,15 @@
|
|
|
23
23
|
},
|
|
24
24
|
"unescape-patterns.js": {
|
|
25
25
|
"templateType": "SupportingFiles"
|
|
26
|
+
},
|
|
27
|
+
"rewrite-http-annotations.js": {
|
|
28
|
+
"templateType": "SupportingFiles"
|
|
29
|
+
},
|
|
30
|
+
"rewrite-path-parameters.js": {
|
|
31
|
+
"templateType": "SupportingFiles"
|
|
32
|
+
},
|
|
33
|
+
"remove-empty-param-objects-from-context.js": {
|
|
34
|
+
"templateType": "SupportingFiles"
|
|
26
35
|
}
|
|
27
36
|
},
|
|
28
37
|
"typeMappings": {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var fs = require('fs')
|
|
2
|
+
|
|
3
|
+
const apiFolder = './api';
|
|
4
|
+
const apiFileSuffix = '.api.ts';
|
|
5
|
+
|
|
6
|
+
// remove empty param objects from context objects
|
|
7
|
+
const apiFiles = fs.readdirSync(apiFolder).filter(fn => fn.endsWith(apiFileSuffix));
|
|
8
|
+
apiFiles.forEach(apiFile => removeEmptyParamObjects(apiFile));
|
|
9
|
+
|
|
10
|
+
function removeEmptyParamObjects(fileName) {
|
|
11
|
+
const file = `${apiFolder}/${fileName}`;
|
|
12
|
+
const contents = fs.readFileSync(file, 'utf-8');
|
|
13
|
+
|
|
14
|
+
const result = contents.replace(/{ params: { }, /g, '{ ');
|
|
15
|
+
|
|
16
|
+
var options = { flag : 'w', encoding: 'utf8' };
|
|
17
|
+
fs.writeFileSync(file, result, options);
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var fs = require('fs')
|
|
2
|
+
|
|
3
|
+
const apiFolder = './api';
|
|
4
|
+
const apiFileSuffix = '.api.ts';
|
|
5
|
+
|
|
6
|
+
// rewrite http annotations
|
|
7
|
+
const apiFiles = fs.readdirSync(apiFolder).filter(fn => fn.endsWith(apiFileSuffix));
|
|
8
|
+
apiFiles.forEach(apiFile => rewriteHttpAnnotations(apiFile));
|
|
9
|
+
|
|
10
|
+
function rewriteHttpAnnotations(fileName) {
|
|
11
|
+
const file = `${apiFolder}/${fileName}`;
|
|
12
|
+
const contents = fs.readFileSync(file, 'utf-8');
|
|
13
|
+
|
|
14
|
+
var result = contents.replace(/ \/\/\/\/ @get/g, ' @Get');
|
|
15
|
+
result = result.replace(/ \/\/\/\/ @post/g, ' @Post');
|
|
16
|
+
result = result.replace(/ \/\/\/\/ @put/g, ' @Put');
|
|
17
|
+
result = result.replace(/ \/\/\/\/ @delete/g, ' @Delete');
|
|
18
|
+
result = result.replace(/ \/\/\/\/ @patch/g, ' @Patch');
|
|
19
|
+
result = result.replace(/ \/\/\/\/ @options/g, ' @Options');
|
|
20
|
+
result = result.replace(/ \/\/\/\/ @head/g, ' @Head');
|
|
21
|
+
|
|
22
|
+
var options = { flag : 'w', encoding: 'utf8' };
|
|
23
|
+
fs.writeFileSync(file, result, options);
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var fs = require('fs')
|
|
2
|
+
|
|
3
|
+
const apiFolder = './api';
|
|
4
|
+
const apiFileSuffix = '.api.ts';
|
|
5
|
+
|
|
6
|
+
// rewrite path parameters
|
|
7
|
+
const apiFiles = fs.readdirSync(apiFolder).filter(fn => fn.endsWith(apiFileSuffix));
|
|
8
|
+
apiFiles.forEach(apiFile => rewritePathParameters(apiFile));
|
|
9
|
+
|
|
10
|
+
function rewritePathParameters(fileName) {
|
|
11
|
+
const file = `${apiFolder}/${fileName}`;
|
|
12
|
+
const contents = fs.readFileSync(file, 'utf-8');
|
|
13
|
+
|
|
14
|
+
var result = contents.replace(/\${encodeURIComponent\(String\(/g, ':');
|
|
15
|
+
result = result.replace(/\)\)\}/g, '');
|
|
16
|
+
|
|
17
|
+
var options = { flag : 'w', encoding: 'utf8' };
|
|
18
|
+
fs.writeFileSync(file, result, options);
|
|
19
|
+
}
|