@kubb/adapter-oas 5.3.12 → 5.3.14
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/dist/index.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -594,12 +594,15 @@ function isBinary(schema) {
|
|
|
594
594
|
return schema.contentMediaType === "application/octet-stream" && schema.contentEncoding === void 0 && (schema.type === void 0 || schema.type === "string");
|
|
595
595
|
}
|
|
596
596
|
/**
|
|
597
|
-
* Returns the binary schema for
|
|
598
|
-
*
|
|
599
|
-
*
|
|
597
|
+
* Returns the binary schema for a non-JSON entry the OAS 3.1 upgrade emptied out, or `undefined`
|
|
598
|
+
* when the entry carries a schema of its own. The upgrade rewrites `format: 'binary'` into
|
|
599
|
+
* `contentMediaType` and drops it whenever it only repeats the media type key, for any binary
|
|
600
|
+
* media type (`application/octet-stream`, `application/pdf`, `image/png`, ...), not just
|
|
601
|
+
* `application/octet-stream`. Without the fallback such a body resolves to the empty schema type
|
|
602
|
+
* instead of a blob.
|
|
600
603
|
*/
|
|
601
604
|
function getBinaryFallbackSchema(mediaType, schema) {
|
|
602
|
-
if (mediaType
|
|
605
|
+
if (!mediaType || isJsonMimeType(mediaType)) return void 0;
|
|
603
606
|
if (schema && Object.keys(schema).length > 0) return void 0;
|
|
604
607
|
return {
|
|
605
608
|
type: "string",
|