@scalar/openapi-parser 0.29.11 → 0.29.12
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/utils/validate.d.ts.map +1 -1
- package/dist/utils/validate.js +10 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @scalar/openapi-parser
|
|
2
2
|
|
|
3
|
+
## 0.29.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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`.
|
|
8
|
+
|
|
3
9
|
## 0.29.11
|
|
4
10
|
|
|
5
11
|
## 0.29.10
|
|
@@ -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.12",
|
|
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.
|
|
51
|
+
"@scalar/helpers": "0.16.2",
|
|
52
|
+
"@scalar/json-magic": "0.15.6",
|
|
53
53
|
"@scalar/openapi-types": "0.9.7",
|
|
54
|
-
"@scalar/openapi-upgrader": "0.4.
|
|
55
|
-
"@scalar/openapi-validator": "0.1.
|
|
56
|
-
"@scalar/types": "0.23.
|
|
54
|
+
"@scalar/openapi-upgrader": "0.4.3",
|
|
55
|
+
"@scalar/openapi-validator": "0.1.11",
|
|
56
|
+
"@scalar/types": "0.23.1",
|
|
57
57
|
"yaml": "^2.9.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|