@readme/oas-to-har 14.0.0 → 14.0.4
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/.github/workflows/ci.yml +2 -5
- package/.github/workflows/codeql-analysis.yml +1 -1
- package/CHANGELOG.md +34 -0
- package/package.json +11 -12
- package/src/index.js +13 -2
- package/src/lib/configure-security.js +0 -1
- package/src/lib/style-formatting/index.js +1 -1
- package/src/lib/style-formatting/style-serializer.js +1 -4
package/.github/workflows/ci.yml
CHANGED
|
@@ -10,16 +10,13 @@ jobs:
|
|
|
10
10
|
node-version: [12.x, 14.x, 16.x]
|
|
11
11
|
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@v2.
|
|
13
|
+
- uses: actions/checkout@v2.4.0
|
|
14
14
|
|
|
15
15
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
16
|
-
uses: actions/setup-node@v2.
|
|
16
|
+
uses: actions/setup-node@v2.5.0
|
|
17
17
|
with:
|
|
18
18
|
node-version: ${{ matrix.node-version }}
|
|
19
19
|
|
|
20
|
-
- name: Install npm@7
|
|
21
|
-
run: npm install -g npm@7
|
|
22
|
-
|
|
23
20
|
- name: Install deps
|
|
24
21
|
run: npm ci
|
|
25
22
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
## <small>14.0.4 (2021-12-16)</small>
|
|
2
|
+
|
|
3
|
+
* fix: issue where we'd try to stylize iterate over a nullilsh value (#42) ([5baa462](https://github.com/readmeio/oas-to-har/commit/5baa462)), closes [#42](https://github.com/readmeio/oas-to-har/issues/42)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## <small>14.0.3 (2021-12-16)</small>
|
|
8
|
+
|
|
9
|
+
* fix: cleaning up engine requirements and updating dev deps (#40) ([c377906](https://github.com/readmeio/oas-to-har/commit/c377906)), closes [#40](https://github.com/readmeio/oas-to-har/issues/40)
|
|
10
|
+
* test: overhauling the test suite to make it easier to maintain (#41) ([e04944d](https://github.com/readmeio/oas-to-har/commit/e04944d)), closes [#41](https://github.com/readmeio/oas-to-har/issues/41)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## <small>14.0.2 (2021-12-01)</small>
|
|
15
|
+
|
|
16
|
+
* chore(deps-dev): bump @commitlint/cli from 14.1.0 to 15.0.0 (#33) ([64cf308](https://github.com/readmeio/oas-to-har/commit/64cf308)), closes [#33](https://github.com/readmeio/oas-to-har/issues/33)
|
|
17
|
+
* chore(deps-dev): bump @commitlint/config-conventional (#37) ([7e76ecd](https://github.com/readmeio/oas-to-har/commit/7e76ecd)), closes [#37](https://github.com/readmeio/oas-to-har/issues/37)
|
|
18
|
+
* chore(deps-dev): bump eslint from 8.2.0 to 8.3.0 (#38) ([b6c0fa2](https://github.com/readmeio/oas-to-har/commit/b6c0fa2)), closes [#38](https://github.com/readmeio/oas-to-har/issues/38)
|
|
19
|
+
* chore(deps-dev): bump jest from 27.3.1 to 27.4.3 (#35) ([f20606b](https://github.com/readmeio/oas-to-har/commit/f20606b)), closes [#35](https://github.com/readmeio/oas-to-har/issues/35)
|
|
20
|
+
* chore(deps-dev): bump prettier from 2.4.1 to 2.5.0 (#39) ([8f63cc6](https://github.com/readmeio/oas-to-har/commit/8f63cc6)), closes [#39](https://github.com/readmeio/oas-to-har/issues/39)
|
|
21
|
+
* chore(deps): bump @readme/oas-extensions from 14.0.0 to 14.0.1 (#34) ([d110b9e](https://github.com/readmeio/oas-to-har/commit/d110b9e)), closes [#34](https://github.com/readmeio/oas-to-har/issues/34)
|
|
22
|
+
* chore(deps): bump actions/checkout from 2.3.5 to 2.4.0 (#32) ([0937308](https://github.com/readmeio/oas-to-har/commit/0937308)), closes [#32](https://github.com/readmeio/oas-to-har/issues/32)
|
|
23
|
+
* chore(deps): bump actions/setup-node from 2.4.1 to 2.5.0 (#31) ([fae7aed](https://github.com/readmeio/oas-to-har/commit/fae7aed)), closes [#31](https://github.com/readmeio/oas-to-har/issues/31)
|
|
24
|
+
* chore(deps): bump oas from 17.1.0 to 17.1.6 (#36) ([0d2f7ff](https://github.com/readmeio/oas-to-har/commit/0d2f7ff)), closes [#36](https://github.com/readmeio/oas-to-har/issues/36)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## <small>14.0.1 (2021-11-29)</small>
|
|
29
|
+
|
|
30
|
+
* fix: bug where nested object formData would be improperly converted as a string (#30) ([4f993a6](https://github.com/readmeio/oas-to-har/commit/4f993a6)), closes [#30](https://github.com/readmeio/oas-to-har/issues/30)
|
|
31
|
+
* chore(deps-dev): upgrading eslint to v8 ([09f4b27](https://github.com/readmeio/oas-to-har/commit/09f4b27))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
1
35
|
## 14.0.0 (2021-11-08)
|
|
2
36
|
|
|
3
37
|
* feat: upgrading oas to v17 (#29) ([c223f7a](https://github.com/readmeio/oas-to-har/commit/c223f7a)), closes [#29](https://github.com/readmeio/oas-to-har/issues/29)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readme/oas-to-har",
|
|
3
3
|
"description": "Utility to transform an OAS operation into a HAR representation",
|
|
4
|
-
"version": "14.0.
|
|
4
|
+
"version": "14.0.4",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Jon Ursenbach <jon@ursenba.ch>",
|
|
7
7
|
"license": "ISC",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"url": "git://github.com/readmeio/oas-to-har.git"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
|
-
"node": "^12 || ^14 || ^16"
|
|
14
|
-
"npm": "^7"
|
|
13
|
+
"node": "^12 || ^14 || ^16"
|
|
15
14
|
},
|
|
16
15
|
"scripts": {
|
|
17
16
|
"lint": "eslint .",
|
|
@@ -22,21 +21,21 @@
|
|
|
22
21
|
"test": "jest --coverage"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
|
-
"@readme/oas-extensions": "^14.0.
|
|
26
|
-
"oas": "^17.
|
|
24
|
+
"@readme/oas-extensions": "^14.0.3",
|
|
25
|
+
"oas": "^17.3.2",
|
|
27
26
|
"parse-data-url": "^4.0.1"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
|
-
"@commitlint/cli": "^
|
|
31
|
-
"@commitlint/config-conventional": "^
|
|
32
|
-
"@readme/eslint-config": "^
|
|
29
|
+
"@commitlint/cli": "^15.0.0",
|
|
30
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
31
|
+
"@readme/eslint-config": "^8.0.4",
|
|
33
32
|
"@readme/oas-examples": "^4.3.2",
|
|
34
33
|
"datauri": "^4.1.0",
|
|
35
|
-
"eslint": "^
|
|
34
|
+
"eslint": "^8.4.1",
|
|
36
35
|
"husky": "^7.0.4",
|
|
37
|
-
"jest": "^27.
|
|
38
|
-
"jest-expect-har": "^3.0.
|
|
39
|
-
"prettier": "^2.
|
|
36
|
+
"jest": "^27.4.5",
|
|
37
|
+
"jest-expect-har": "^3.0.1",
|
|
38
|
+
"prettier": "^2.5.1"
|
|
40
39
|
},
|
|
41
40
|
"prettier": "@readme/eslint-config/prettier",
|
|
42
41
|
"commitlint": {
|
package/src/index.js
CHANGED
|
@@ -65,6 +65,16 @@ function stringify(json) {
|
|
|
65
65
|
return JSON.stringify(removeUndefinedObjects(typeof json.RAW_BODY !== 'undefined' ? json.RAW_BODY : json));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function stringifyParameter(param) {
|
|
69
|
+
if (param === null || isPrimitive(param)) {
|
|
70
|
+
return param;
|
|
71
|
+
} else if (Array.isArray(param) && param.every(isPrimitive)) {
|
|
72
|
+
return String(param);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return JSON.stringify(param);
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
function appendHarValue(harParam, name, value) {
|
|
69
79
|
if (typeof value === 'undefined') return;
|
|
70
80
|
|
|
@@ -220,7 +230,7 @@ module.exports = (
|
|
|
220
230
|
});
|
|
221
231
|
}
|
|
222
232
|
|
|
223
|
-
// Are there `x-
|
|
233
|
+
// Are there `x-headers` static headers configured for this OAS?
|
|
224
234
|
const userDefinedHeaders = extensions.getExtension(extensions.HEADERS, oas, operation);
|
|
225
235
|
if (userDefinedHeaders) {
|
|
226
236
|
userDefinedHeaders.forEach(header => {
|
|
@@ -262,7 +272,7 @@ module.exports = (
|
|
|
262
272
|
Object.keys(cleanFormData).forEach(name => {
|
|
263
273
|
har.postData.params.push({
|
|
264
274
|
name,
|
|
265
|
-
value:
|
|
275
|
+
value: stringifyParameter(cleanFormData[name]),
|
|
266
276
|
});
|
|
267
277
|
});
|
|
268
278
|
}
|
|
@@ -354,6 +364,7 @@ module.exports = (
|
|
|
354
364
|
}
|
|
355
365
|
});
|
|
356
366
|
|
|
367
|
+
// `RAW_BODY` is a ReadMe-specific thing where we'll interpret its contents as raw JSON.
|
|
357
368
|
if (typeof cleanBody.RAW_BODY !== 'undefined') {
|
|
358
369
|
cleanBody = cleanBody.RAW_BODY;
|
|
359
370
|
}
|
|
@@ -25,7 +25,6 @@ module.exports = function configureSecurity(apiDefinition, values, scheme) {
|
|
|
25
25
|
|
|
26
26
|
return harValue('headers', {
|
|
27
27
|
name: 'Authorization',
|
|
28
|
-
// eslint-disable-next-line sonarjs/no-nested-template-literals
|
|
29
28
|
value: `Basic ${Buffer.from(`${user}:${pass}`).toString('base64')}`,
|
|
30
29
|
});
|
|
31
30
|
} else if (security.scheme === 'bearer') {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/* eslint-disable sonarjs/no-extra-arguments */
|
|
2
1
|
/* eslint-disable no-use-before-define */
|
|
3
|
-
/* eslint-disable sonarjs/prefer-immediate-return */
|
|
4
2
|
/* eslint-disable no-param-reassign */
|
|
5
|
-
/* eslint-disable sonarjs/no-identical-functions */
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* This file has been extracted and modified from `swagger-client`.
|
|
@@ -39,7 +36,7 @@ module.exports = function stylize(config) {
|
|
|
39
36
|
|
|
40
37
|
module.exports.encodeDisallowedCharacters = function encodeDisallowedCharacters(
|
|
41
38
|
str,
|
|
42
|
-
{ escape, returnIfEncoded = false } = {},
|
|
39
|
+
{ escape, returnIfEncoded = false } = {}, // eslint-disable-line default-param-last
|
|
43
40
|
parse
|
|
44
41
|
) {
|
|
45
42
|
if (typeof str === 'number') {
|