@@ -105,21 +105,13 @@ const RequestBody = ({
105105 }
106106 requestBodyErrors = List . isList ( requestBodyErrors ) ? requestBodyErrors : List ( )
107107
108- if ( ! mediaTypeValue . size ) {
109- return null
110- }
111-
112- const isObjectContent = mediaTypeValue . getIn ( [ "schema" , "type" ] ) === "object"
113- const isBinaryFormat = mediaTypeValue . getIn ( [ "schema" , "format" ] ) === "binary"
114- const isBase64Format = mediaTypeValue . getIn ( [ "schema" , "format" ] ) === "base64"
108+ const isFileUploadIntended = fn . isFileUploadIntended (
109+ mediaTypeValue ?. get ( "schema" ) ,
110+ contentType
111+ )
115112
116113 if (
117- contentType === "application/octet-stream"
118- || contentType . indexOf ( "image/" ) === 0
119- || contentType . indexOf ( "audio/" ) === 0
120- || contentType . indexOf ( "video/" ) === 0
121- || isBinaryFormat
122- || isBase64Format
114+ isFileUploadIntended
123115 ) {
124116 const Input = getComponent ( "Input" )
125117
@@ -132,6 +124,13 @@ const RequestBody = ({
132124 return < Input type = { "file" } onChange = { handleFile } />
133125 }
134126
127+
128+ if ( ! mediaTypeValue . size ) {
129+ return null
130+ }
131+
132+ const isObjectContent = fn . hasSchemaType ( mediaTypeValue . get ( "schema" ) , "object" )
133+
135134 if (
136135 isObjectContent &&
137136 (
@@ -190,11 +189,11 @@ const RequestBody = ({
190189 initialValue = JSON . parse ( initialValue )
191190 }
192191
193- const isFile = type === "string" && ( format === "binary" || format === "base64" )
192+ const isFileUploadIntended = fn . isFileUploadIntended ( schema )
194193
195194 const jsonSchemaForm = < JsonSchemaForm
196195 fn = { fn }
197- dispatchInitialValue = { ! isFile }
196+ dispatchInitialValue = { ! isFileUploadIntended }
198197 schema = { schema }
199198 description = { key }
200199 getComponent = { getComponent }
0 commit comments