@scalar/openapi-parser 0.10.12 → 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,11 @@
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
+
3
9
  ## 0.10.12
4
10
 
5
11
  ### 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#'
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "parser",
18
18
  "typescript"
19
19
  ],
20
- "version": "0.10.12",
20
+ "version": "0.10.13",
21
21
  "engines": {
22
22
  "node": ">=18"
23
23
  },
@@ -64,9 +64,9 @@
64
64
  "json-to-ast": "^2.1.0",
65
65
  "just-diff": "^6.0.2",
66
66
  "tinybench": "^2.8.0",
67
- "@scalar/types": "0.1.2",
68
67
  "@scalar/build-tooling": "0.1.17",
69
- "@scalar/openapi-types": "0.1.9"
68
+ "@scalar/types": "0.1.5",
69
+ "@scalar/openapi-types": "0.2.0"
70
70
  },
71
71
  "scripts": {
72
72
  "build": "scalar-build-rollup",