Skip to content

Commit

Permalink
feat(ux): show file upload when schema has "format: binary", fixes sw…
Browse files Browse the repository at this point in the history
  • Loading branch information
neiser committed Jun 18, 2021
1 parent c38502e commit 49c3f3b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/plugins/oas3/components/request-body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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 = []
Expand Down

0 comments on commit 49c3f3b

Please sign in to comment.