@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @scalar/openapi-parser
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2498fc2: fix: make new parser behave like previous one on missing info.version
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  ### Minor Changes
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
- const n = e.find((s) => s.isEntrypoint), r = n == null ? void 0 : n.specification;
11938
- this.specification = r;
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: s, specificationType: i, specificationVersion: a } = Hc(r);
11947
- if (this.version = s, this.specificationVersion = a, this.specificationType = i, !s)
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 o = await this.getAjvValidator(s);
11956
- return o(r) ? O0(n.specification) : o.errors && o.errors.length > 0 ? {
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, o.errors)
11959
+ errors: Fn(n, c.errors)
11959
11960
  } : {
11960
11961
  valid: !1
11961
11962
  };
11962
- } catch (s) {
11963
+ } catch (i) {
11963
11964
  return {
11964
11965
  valid: !1,
11965
- errors: Fn(n, s.message ?? s)
11966
+ errors: Fn(n, i.message ?? i)
11966
11967
  };
11967
11968
  }
11968
11969
  }
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "author": "Scalar (https://github.com/scalar)",
13
13
  "homepage": "https://github.com/scalar/scalar",
14
14
  "bugs": "https://github.com/scalar/scalar/issues/new/choose",
15
- "version": "0.3.0",
15
+ "version": "0.3.1",
16
16
  "engines": {
17
17
  "node": ">=18"
18
18
  },