Skip to content

Commit 66184ee

Browse files
committed
feat(ux): show file upload when schema has "format: binary", fixes #5636
1 parent 98a87ea commit 66184ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/plugins/oas3/components/request-body.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,14 @@ const RequestBody = ({
107107
}
108108

109109
const isObjectContent = mediaTypeValue.getIn(["schema", "type"]) === "object"
110+
const isBinaryFormat = mediaTypeValue.getIn(["schema", "format"]) === "binary"
110111

111112
if(
112113
contentType === "application/octet-stream"
113114
|| contentType.indexOf("image/") === 0
114115
|| contentType.indexOf("audio/") === 0
115116
|| contentType.indexOf("video/") === 0
117+
|| isBinaryFormat
116118
) {
117119
const Input = getComponent("Input")
118120

@@ -163,7 +165,7 @@ const RequestBody = ({
163165
|| prop.hasIn(["items", "default"])
164166
const useInitialValFromEnum = prop.has("enum") && (prop.get("enum").size === 1 || required)
165167
const useInitialValue = useInitialValFromSchemaSamples || useInitialValFromEnum
166-
168+
167169
let initialValue = ""
168170
if(type === "array" && !useInitialValue) {
169171
initialValue = []

0 commit comments

Comments
 (0)