fix: coerce multipart initial property values to string (via #5166)
* coerce multipart initial property values to string * add tests
This commit is contained in:
@@ -2,7 +2,7 @@ import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import ImPropTypes from "react-immutable-proptypes"
|
||||
import { Map, OrderedMap, List } from "immutable"
|
||||
import { getCommonExtensions, getSampleSchema } from "core/utils"
|
||||
import { getCommonExtensions, getSampleSchema, stringify } from "core/utils"
|
||||
|
||||
const RequestBody = ({
|
||||
requestBody,
|
||||
@@ -83,15 +83,19 @@ const RequestBody = ({
|
||||
|
||||
let initialValue = prop.get("default") || prop.get("example") || ""
|
||||
|
||||
if(initialValue === "" && type === "object") {
|
||||
if (initialValue === "" && type === "object") {
|
||||
initialValue = getSampleSchema(prop, false, {
|
||||
includeWriteOnly: true
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof initialValue !== "string" && type === "object") {
|
||||
initialValue = stringify(initialValue)
|
||||
}
|
||||
|
||||
const isFile = type === "string" && (format === "binary" || format === "base64")
|
||||
|
||||
return <tr key={key} className="parameters">
|
||||
return <tr key={key} className="parameters" data-property-name={key}>
|
||||
<td className="col parameters-col_name">
|
||||
<div className={required ? "parameter__name required" : "parameter__name"}>
|
||||
{ key }
|
||||
|
||||
Reference in New Issue
Block a user