@scalar/openapi-parser 0.28.12 → 0.28.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
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @scalar/openapi-parser
|
|
2
2
|
|
|
3
|
+
## 0.28.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#9838](https://github.com/scalar/scalar/pull/9838): Show a clearer error when a response is missing its `description`. Before, the
|
|
8
|
+
validator reported the confusing `must have required property '$ref'` (or
|
|
9
|
+
`oneOf must match exactly one schema in oneOf`) instead of pointing at the
|
|
10
|
+
actual problem.
|
|
11
|
+
|
|
3
12
|
## 0.28.12
|
|
4
13
|
|
|
5
14
|
## 0.28.11
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/betterAjvErrors/helpers.ts"],"names":[],"mappings":"AAcA,OAAO,EAGL,mBAAmB,EAKpB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/betterAjvErrors/helpers.ts"],"names":[],"mappings":"AAcA,OAAO,EAGL,mBAAmB,EAKpB,MAAM,qBAAqB,CAAA;AAwK5B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,SAAS,KAAA,EAAE,OAAO,KAAA,yBAKlD"}
|
|
@@ -52,8 +52,14 @@ function filterRedundantErrors(root, parent, key) {
|
|
|
52
52
|
delete root.errors;
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
//
|
|
56
|
-
|
|
55
|
+
// Both `oneOf` branches produced a `required` error: one from the schema
|
|
56
|
+
// the user most likely intended (e.g. a Response needs `description`) and
|
|
57
|
+
// one from the `Reference` branch (needs `$ref`). Surface the intended
|
|
58
|
+
// schema's error and drop the `$ref` noise so the message is actionable.
|
|
59
|
+
// Only fall back to the generic `oneOf` error when the sole requirement
|
|
60
|
+
// left is `$ref` (i.e. the value looks like a broken reference).
|
|
61
|
+
const meaningfulRequiredErrors = errors.filter((error) => isRequiredError(error) && error.params?.missingProperty !== '$ref');
|
|
62
|
+
root.errors = meaningfulRequiredErrors.length > 0 ? meaningfulRequiredErrors : errors.filter(isOneOfError);
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
else if (hasOneOfError && !hasRequiredError && hasChildren) {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"parser",
|
|
18
18
|
"typescript"
|
|
19
19
|
],
|
|
20
|
-
"version": "0.28.
|
|
20
|
+
"version": "0.28.13",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=22"
|
|
23
23
|
},
|
|
@@ -54,17 +54,17 @@
|
|
|
54
54
|
"jsonpointer": "^5.0.1",
|
|
55
55
|
"leven": "^4.0.0",
|
|
56
56
|
"yaml": "^2.9.0",
|
|
57
|
-
"@scalar/helpers": "0.10.0",
|
|
58
57
|
"@scalar/json-magic": "0.12.20",
|
|
58
|
+
"@scalar/openapi-types": "0.9.4",
|
|
59
59
|
"@scalar/openapi-upgrader": "0.2.13",
|
|
60
|
-
"@scalar/
|
|
60
|
+
"@scalar/helpers": "0.10.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
64
64
|
"@types/node": "^24.1.0",
|
|
65
65
|
"just-diff": "^6.0.2",
|
|
66
66
|
"vite": "8.1.5",
|
|
67
|
-
"@scalar/types": "0.
|
|
67
|
+
"@scalar/types": "0.18.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|