@scalar/openapi-parser 0.29.11 → 0.29.13
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 +13 -0
- package/dist/utils/openapi/actions/details.d.ts.map +1 -1
- package/dist/utils/openapi/actions/details.js +1 -1
- package/dist/utils/openapi/actions/files.d.ts.map +1 -1
- package/dist/utils/openapi/actions/get.d.ts.map +1 -1
- package/dist/utils/openapi/actions/toJson.d.ts.map +1 -1
- package/dist/utils/openapi/actions/toYaml.d.ts.map +1 -1
- package/dist/utils/openapi/openapi.d.ts.map +1 -1
- package/dist/utils/openapi/utils/workThroughQueue.d.ts.map +1 -1
- package/dist/utils/openapi/utils/workThroughQueue.js +5 -6
- package/dist/utils/resolve-references.js +3 -3
- package/dist/utils/validate.d.ts.map +1 -1
- package/dist/utils/validate.js +10 -4
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @scalar/openapi-parser
|
|
2
2
|
|
|
3
|
+
## 0.29.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#10559](https://github.com/scalar/scalar/pull/10559): Clean up Biome warnings in package code and tests. Handle rejected debounced callbacks and await streaming writes.
|
|
8
|
+
- [#10506](https://github.com/scalar/scalar/pull/10506): Organize imports consistently with the checks enforced in CI.
|
|
9
|
+
|
|
10
|
+
## 0.29.12
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#10489](https://github.com/scalar/scalar/pull/10489): Report invalid non-exploded structured cookies in OpenAPI 3.2 documents and prevent invalid request and code sample generation. Recommend `style: cookie` with `explode: true`.
|
|
15
|
+
|
|
3
16
|
## 0.29.11
|
|
4
17
|
|
|
5
18
|
## 0.29.10
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/details.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAK3D;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAI3G"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getEntrypoint } from '../../../utils/get-entrypoint.js';
|
|
2
1
|
import { details as detailsUtility } from '../../../utils/details.js';
|
|
2
|
+
import { getEntrypoint } from '../../../utils/get-entrypoint.js';
|
|
3
3
|
import { workThroughQueue } from '../utils/workThroughQueue.js';
|
|
4
4
|
/**
|
|
5
5
|
* Run the chained tasks and return just some basic information about the OpenAPI document
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAI5D;;GAEG;AACH,wBAAsB,KAAK,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAIlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/get.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/get.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAI9D;;GAEG;AACH,wBAAsB,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAKrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toJson.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/toJson.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toJson.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/toJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAMhD;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAI3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toYaml.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/toYaml.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toYaml.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/toYaml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAMhD;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/utils/openapi/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAS,MAAM,eAAe,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/utils/openapi/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAS,MAAM,eAAe,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAIpD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,aAAa,CAAC,EAAE,cAAc;kBASpC,sBAAsB,YAAY,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workThroughQueue.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/utils/workThroughQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAO9D;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"workThroughQueue.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/utils/workThroughQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAO9D;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAiElG"}
|
|
@@ -16,12 +16,11 @@ export async function workThroughQueue(queue) {
|
|
|
16
16
|
const name = task.name;
|
|
17
17
|
const options = 'options' in task ? task.options : undefined;
|
|
18
18
|
// Use the result of the previous task, or fall back to the original input
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
: input;
|
|
19
|
+
let currentSpecification = result.specification || input;
|
|
20
|
+
if (!result.specification && typeof input === 'object') {
|
|
21
|
+
// Detach from the original object.
|
|
22
|
+
currentSpecification = structuredClone(input);
|
|
23
|
+
}
|
|
25
24
|
// load
|
|
26
25
|
if (name === 'load') {
|
|
27
26
|
result = {
|
|
@@ -36,11 +36,11 @@ errors = []) {
|
|
|
36
36
|
// Recursively resolve all references
|
|
37
37
|
dereference(finalInput, filesystem, file ?? entrypoint, new WeakSet(), errors, options);
|
|
38
38
|
// Remove duplicates (according to message) from errors
|
|
39
|
-
|
|
39
|
+
const uniqueErrors = errors.filter((error, index, self) => index === self.findIndex((t) => t.message === error.message && t.code === error.code));
|
|
40
40
|
// Return the resolved specification
|
|
41
41
|
return {
|
|
42
|
-
valid:
|
|
43
|
-
errors,
|
|
42
|
+
valid: uniqueErrors.length === 0,
|
|
43
|
+
errors: uniqueErrors,
|
|
44
44
|
schema: finalInput,
|
|
45
45
|
};
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAe,UAAU,EAAyB,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAMvH,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAA;AAqBhD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,UAAU,EAC1C,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CA6FzB"}
|
package/dist/utils/validate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isObject } from '@scalar/helpers/object/is-object';
|
|
2
|
-
import { validate as validateDocument, validatePathParameters } from '@scalar/openapi-validator';
|
|
2
|
+
import { validateCookieParameters, validate as validateDocument, validatePathParameters, } from '@scalar/openapi-validator';
|
|
3
3
|
import { ERRORS } from '../configuration/index.js';
|
|
4
4
|
import { getEntrypoint } from './get-entrypoint.js';
|
|
5
5
|
import { makeFilesystem } from './make-filesystem.js';
|
|
@@ -53,17 +53,23 @@ export function validate(value, options) {
|
|
|
53
53
|
// validator's default) and run below on the resolved document, so parameters
|
|
54
54
|
// declared via `$ref` are seen (validating the unresolved document would
|
|
55
55
|
// report them as missing).
|
|
56
|
-
const outcome = validateDocument(specification, options);
|
|
56
|
+
const outcome = validateDocument(specification, { ...options, checkCookieParameters: false });
|
|
57
57
|
// Resolve references whenever the document passed schema validation.
|
|
58
58
|
// `outcome.schema` is only set once schema and version validation succeeded.
|
|
59
59
|
const passedSchemaValidation = outcome.schema !== undefined;
|
|
60
60
|
const resolved = passedSchemaValidation ? resolveReferences(filesystem, options) : undefined;
|
|
61
61
|
const referenceErrors = resolved?.errors ?? [];
|
|
62
62
|
const schema = (resolved?.schema ?? outcome.schema);
|
|
63
|
-
//
|
|
63
|
+
// Parameter semantics run on the resolved document (schema validation
|
|
64
64
|
// stays on the unresolved one to avoid following circular references). This
|
|
65
65
|
// matches the previous validator, which merged reference and semantic errors.
|
|
66
|
-
const
|
|
66
|
+
const cookieErrors = passedSchemaValidation ? validateCookieParameters(schema ?? specification) : [];
|
|
67
|
+
if (cookieErrors.length && options?.throwOnError) {
|
|
68
|
+
throw new Error(cookieErrors[0]?.message);
|
|
69
|
+
}
|
|
70
|
+
const semanticErrors = passedSchemaValidation
|
|
71
|
+
? [...validatePathParameters(schema ?? specification), ...cookieErrors]
|
|
72
|
+
: [];
|
|
67
73
|
const errors = [...(outcome.errors ?? []), ...referenceErrors, ...semanticErrors];
|
|
68
74
|
const valid = outcome.valid && referenceErrors.length === 0 && semanticErrors.length === 0;
|
|
69
75
|
if (!valid) {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"parser",
|
|
18
18
|
"typescript"
|
|
19
19
|
],
|
|
20
|
-
"version": "0.29.
|
|
20
|
+
"version": "0.29.13",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=22"
|
|
23
23
|
},
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
],
|
|
49
49
|
"sideEffects": false,
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@scalar/helpers": "0.16.
|
|
52
|
-
"@scalar/json-magic": "0.15.
|
|
53
|
-
"@scalar/openapi-types": "0.9.
|
|
54
|
-
"@scalar/openapi-upgrader": "0.4.
|
|
55
|
-
"@scalar/openapi-validator": "0.1.
|
|
56
|
-
"@scalar/types": "0.23.
|
|
51
|
+
"@scalar/helpers": "0.16.3",
|
|
52
|
+
"@scalar/json-magic": "0.15.7",
|
|
53
|
+
"@scalar/openapi-types": "0.9.8",
|
|
54
|
+
"@scalar/openapi-upgrader": "0.4.4",
|
|
55
|
+
"@scalar/openapi-validator": "0.1.12",
|
|
56
|
+
"@scalar/types": "0.23.2",
|
|
57
57
|
"yaml": "^2.9.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|