@scalar/postman-to-openapi 0.7.34 → 0.7.35
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 +6 -0
- package/dist/convert.d.ts.map +1 -1
- package/dist/convert.js +1 -6
- package/dist/helpers/normalize-description.d.ts +4 -0
- package/dist/helpers/normalize-description.d.ts.map +1 -0
- package/dist/helpers/normalize-description.js +7 -0
- package/dist/helpers/parameters.d.ts.map +1 -1
- package/dist/helpers/parameters.js +4 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAqBxD,OAAO,KAAK,EAAyB,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEvE;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,MAAM,EAAE,CAAA;AAqDvD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAA;AAisBhD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAA;IACtD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC,CAAA;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,iBAAiB,EAAE,iBAAiB,GAAG,MAAM,EAC7C,OAAO,GAAE,cAA0C,GAClD,WAAW,CAAC,QAAQ,CAqOtB"}
|
package/dist/convert.js
CHANGED
|
@@ -4,16 +4,11 @@ import { processExternalDocs } from './helpers/external-docs.js';
|
|
|
4
4
|
import { processLicense } from './helpers/license.js';
|
|
5
5
|
import { processLogo } from './helpers/logo.js';
|
|
6
6
|
import { DEFAULT_EXAMPLE_NAME, OPERATION_KEYS, mergePathItem } from './helpers/merge-path-item.js';
|
|
7
|
+
import { normalizeDescription } from './helpers/normalize-description.js';
|
|
7
8
|
import { POSTMAN_EXAMPLE_NAME_EXTENSION, POSTMAN_FOLDER_SEGMENTS_EXTENSION, POSTMAN_POST_RESPONSE_SCRIPTS_EXTENSION, POSTMAN_PRE_REQUEST_SCRIPTS_EXTENSION, processItem, } from './helpers/path-items.js';
|
|
8
9
|
import { pruneDocument } from './helpers/prune-document.js';
|
|
9
10
|
import { analyzeServerDistribution } from './helpers/servers.js';
|
|
10
11
|
import { createCollectionVariableLookup, getPathStructuralSignature, normalizePath } from './helpers/urls.js';
|
|
11
|
-
const normalizeDescription = (description) => {
|
|
12
|
-
if (typeof description === 'string') {
|
|
13
|
-
return description;
|
|
14
|
-
}
|
|
15
|
-
return description?.content;
|
|
16
|
-
};
|
|
17
12
|
const parseCollectionInput = (postmanCollection) => {
|
|
18
13
|
if (typeof postmanCollection !== 'string') {
|
|
19
14
|
return postmanCollection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-description.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,gEAAgE;AAChE,eAAO,MAAM,oBAAoB,GAAI,cAAc,WAAW,KAAG,MAAM,GAAG,SAMzE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/helpers/parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/helpers/parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,SAAS,CAAA;AAwC9C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAC9B,WAAW,CAAC,eAAe,EAAE,CA8D/B;AAoBD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,EACpC,WAAW,EAAE,MAAM,GAClB,WAAW,CAAC,eAAe,CAyD7B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeDescription } from './normalize-description.js';
|
|
1
2
|
import { inferSchemaType } from './schemas.js';
|
|
2
3
|
/**
|
|
3
4
|
* Header keys (lower-case) that never become `parameters[in=header]` on an
|
|
@@ -114,10 +115,11 @@ function extractPathVariablesFromPathArray(pathArray) {
|
|
|
114
115
|
* Creates an OpenAPI parameter object from a Postman parameter.
|
|
115
116
|
*/
|
|
116
117
|
export function createParameterObject(param, paramIn, exampleName) {
|
|
118
|
+
const description = normalizeDescription(param.description);
|
|
117
119
|
const parameter = {
|
|
118
120
|
name: param.key || '',
|
|
119
121
|
in: paramIn,
|
|
120
|
-
description
|
|
122
|
+
description,
|
|
121
123
|
examples: {
|
|
122
124
|
[exampleName]: {
|
|
123
125
|
value: param.value,
|
|
@@ -131,7 +133,7 @@ export function createParameterObject(param, paramIn, exampleName) {
|
|
|
131
133
|
}
|
|
132
134
|
else if (paramIn === 'query') {
|
|
133
135
|
// Check if the parameter is required based on description or name
|
|
134
|
-
const isRequired =
|
|
136
|
+
const isRequired = description?.toLowerCase().includes('[required]') || (param.key && param.key.toLowerCase() === 'required');
|
|
135
137
|
if (isRequired) {
|
|
136
138
|
parameter.required = true;
|
|
137
139
|
// Remove '[required]' from the description
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"export",
|
|
20
20
|
"scalar"
|
|
21
21
|
],
|
|
22
|
-
"version": "0.7.
|
|
22
|
+
"version": "0.7.35",
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=22"
|
|
25
25
|
},
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"CHANGELOG.md"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@scalar/helpers": "0.
|
|
41
|
+
"@scalar/helpers": "0.19.0",
|
|
42
42
|
"@scalar/openapi-types": "0.9.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@scalar/openapi-parser": "0.29.
|
|
45
|
+
"@scalar/openapi-parser": "0.29.26",
|
|
46
46
|
"@types/node": "^24.19.2",
|
|
47
47
|
"vite": "8.3.8"
|
|
48
48
|
},
|