@scalar/openapi-parser 0.10.11 → 0.10.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,17 @@
1
1
  # @scalar/openapi-parser
2
2
 
3
+ ## 0.10.13
4
+
5
+ ### Patch Changes
6
+
7
+ - d5a687f: fix: byte format is ignored when upgrading from OpenAPI 3.0 to OpenAPI 3.1
8
+
9
+ ## 0.10.12
10
+
11
+ ### Patch Changes
12
+
13
+ - cbc1d08: fix: swagger 2.0 basePath is ignored, if there’s no host
14
+
3
15
  ## 0.10.11
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"upgradeFromThreeToThreeOne.d.ts","sourceRoot":"","sources":["../../src/utils/upgradeFromThreeToThreeOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAIxD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;mBAwH9E;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAsBpD"}
1
+ {"version":3,"file":"upgradeFromThreeToThreeOne.d.ts","sourceRoot":"","sources":["../../src/utils/upgradeFromThreeToThreeOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAIxD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;mBAuI9E;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAsBpD"}
@@ -104,6 +104,18 @@ function upgradeFromThreeToThreeOne(originalSpecification) {
104
104
  }
105
105
  return schema;
106
106
  });
107
+ specification = traverse(specification, (schema, path) => {
108
+ if (schema.type === 'string' && schema.format === 'byte') {
109
+ const parentPath = path.slice(0, -1);
110
+ const contentMediaType = parentPath.find((_, index) => path[index - 1] === 'content');
111
+ return {
112
+ type: 'string',
113
+ contentEncoding: 'base64',
114
+ contentMediaType,
115
+ };
116
+ }
117
+ return schema;
118
+ });
107
119
  // Declaring $schema Dialects to protect against change
108
120
  // if (typeof specification.$schema === 'undefined') {
109
121
  // specification.$schema = 'http://json-schema.org/draft-07/schema#'
@@ -1 +1 @@
1
- {"version":3,"file":"upgradeFromTwoToThree.d.ts","sourceRoot":"","sources":["../../src/utils/upgradeFromTwoToThree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAIxD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,aAAa,0CAgOzE"}
1
+ {"version":3,"file":"upgradeFromTwoToThree.d.ts","sourceRoot":"","sources":["../../src/utils/upgradeFromTwoToThree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAIxD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,aAAa,0CAmOzE"}
@@ -26,6 +26,10 @@ function upgradeFromTwoToThree(originalSpecification) {
26
26
  delete specification.schemes;
27
27
  delete specification.host;
28
28
  }
29
+ else if (specification.basePath) {
30
+ specification.servers = [{ url: specification.basePath }];
31
+ delete specification.basePath;
32
+ }
29
33
  // Schemas
30
34
  if (specification.definitions) {
31
35
  specification.components = Object.assign({}, specification.components, {
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "parser",
18
18
  "typescript"
19
19
  ],
20
- "version": "0.10.11",
20
+ "version": "0.10.13",
21
21
  "engines": {
22
22
  "node": ">=18"
23
23
  },
@@ -65,8 +65,8 @@
65
65
  "just-diff": "^6.0.2",
66
66
  "tinybench": "^2.8.0",
67
67
  "@scalar/build-tooling": "0.1.17",
68
- "@scalar/openapi-types": "0.1.9",
69
- "@scalar/types": "0.1.2"
68
+ "@scalar/types": "0.1.5",
69
+ "@scalar/openapi-types": "0.2.0"
70
70
  },
71
71
  "scripts": {
72
72
  "build": "scalar-build-rollup",