From 49c3f3bb4d98abb1da589bb6962745ea5d2b5340 Mon Sep 17 00:00:00 2001 From: Andreas Grub Date: Fri, 28 May 2021 08:33:36 +0200 Subject: [PATCH] feat(ux): show file upload when schema has "format: binary", fixes #5636 --- src/core/plugins/oas3/components/request-body.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index 80e6e2360c6..bd0285ec4b8 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -107,12 +107,14 @@ const RequestBody = ({ } const isObjectContent = mediaTypeValue.getIn(["schema", "type"]) === "object" + const isBinaryFormat = mediaTypeValue.getIn(["schema", "format"]) === "binary" if( contentType === "application/octet-stream" || contentType.indexOf("image/") === 0 || contentType.indexOf("audio/") === 0 || contentType.indexOf("video/") === 0 + || isBinaryFormat ) { const Input = getComponent("Input") @@ -163,7 +165,7 @@ const RequestBody = ({ || prop.hasIn(["items", "default"]) const useInitialValFromEnum = prop.has("enum") && (prop.get("enum").size === 1 || required) const useInitialValue = useInitialValFromSchemaSamples || useInitialValFromEnum - + let initialValue = "" if(type === "array" && !useInitialValue) { initialValue = []