@scalar/openapi-parser 0.3.0 → 0.3.1
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/index.js +10 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -11934,8 +11934,9 @@ class ua {
|
|
|
11934
11934
|
* Checks whether a specification is valid and all references can be resolved.
|
|
11935
11935
|
*/
|
|
11936
11936
|
async validate(e) {
|
|
11937
|
-
|
|
11938
|
-
|
|
11937
|
+
var s;
|
|
11938
|
+
const n = e.find((i) => i.isEntrypoint), r = n == null ? void 0 : n.specification;
|
|
11939
|
+
this.specification = r, (s = this.specification) != null && s.info && !this.specification.info.version && (this.specification.info.version = "0.0.1");
|
|
11939
11940
|
try {
|
|
11940
11941
|
if (r == null)
|
|
11941
11942
|
return {
|
|
@@ -11943,8 +11944,8 @@ class ua {
|
|
|
11943
11944
|
errors: Fn(n, Rr.EMPTY_OR_INVALID)
|
|
11944
11945
|
};
|
|
11945
11946
|
Object.keys(this.externalRefs).length > 0 && (r[fy] = this.externalRefs);
|
|
11946
|
-
const { version:
|
|
11947
|
-
if (this.version =
|
|
11947
|
+
const { version: i, specificationType: a, specificationVersion: o } = Hc(r);
|
|
11948
|
+
if (this.version = i, this.specificationVersion = o, this.specificationType = a, !i)
|
|
11948
11949
|
return {
|
|
11949
11950
|
valid: !1,
|
|
11950
11951
|
errors: Fn(
|
|
@@ -11952,17 +11953,17 @@ class ua {
|
|
|
11952
11953
|
Rr.OPENAPI_VERSION_NOT_SUPPORTED
|
|
11953
11954
|
)
|
|
11954
11955
|
};
|
|
11955
|
-
const
|
|
11956
|
-
return
|
|
11956
|
+
const c = await this.getAjvValidator(i);
|
|
11957
|
+
return c(r) ? O0(n.specification) : c.errors && c.errors.length > 0 ? {
|
|
11957
11958
|
valid: !1,
|
|
11958
|
-
errors: Fn(n,
|
|
11959
|
+
errors: Fn(n, c.errors)
|
|
11959
11960
|
} : {
|
|
11960
11961
|
valid: !1
|
|
11961
11962
|
};
|
|
11962
|
-
} catch (
|
|
11963
|
+
} catch (i) {
|
|
11963
11964
|
return {
|
|
11964
11965
|
valid: !1,
|
|
11965
|
-
errors: Fn(n,
|
|
11966
|
+
errors: Fn(n, i.message ?? i)
|
|
11966
11967
|
};
|
|
11967
11968
|
}
|
|
11968
11969
|
}
|
package/package.json
CHANGED