@kubb/adapter-oas 5.3.13 → 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.cjs
CHANGED
|
@@ -617,12 +617,15 @@ function isBinary(schema) {
|
|
|
617
617
|
return schema.contentMediaType === "application/octet-stream" && schema.contentEncoding === void 0 && (schema.type === void 0 || schema.type === "string");
|
|
618
618
|
}
|
|
619
619
|
/**
|
|
620
|
-
* Returns the binary schema for
|
|
621
|
-
*
|
|
622
|
-
*
|
|
620
|
+
* Returns the binary schema for a non-JSON entry the OAS 3.1 upgrade emptied out, or `undefined`
|
|
621
|
+
* when the entry carries a schema of its own. The upgrade rewrites `format: 'binary'` into
|
|
622
|
+
* `contentMediaType` and drops it whenever it only repeats the media type key, for any binary
|
|
623
|
+
* media type (`application/octet-stream`, `application/pdf`, `image/png`, ...), not just
|
|
624
|
+
* `application/octet-stream`. Without the fallback such a body resolves to the empty schema type
|
|
625
|
+
* instead of a blob.
|
|
623
626
|
*/
|
|
624
627
|
function getBinaryFallbackSchema(mediaType, schema) {
|
|
625
|
-
if (mediaType
|
|
628
|
+
if (!mediaType || isJsonMimeType(mediaType)) return void 0;
|
|
626
629
|
if (schema && Object.keys(schema).length > 0) return void 0;
|
|
627
630
|
return {
|
|
628
631
|
type: "string",
|