fix(sample-gen): oas3 form-data object should generate example (#7355)

This commit is contained in:
Tim Lai
2021-06-18 16:49:50 -07:00
committed by GitHub
parent 89146ba257
commit 87ded996fa
3 changed files with 48 additions and 2 deletions

View File

@@ -165,14 +165,16 @@ const RequestBody = ({
const useInitialValue = useInitialValFromSchemaSamples || useInitialValFromEnum
let initialValue = ""
if(type === "array" && !useInitialValue) {
if (type === "array" && !useInitialValue) {
initialValue = []
} else if (useInitialValue) {
}
if (type === "object" || useInitialValue) {
// TODO: what about example or examples from requestBody could be passed as exampleOverride
initialValue = getSampleSchema(prop, false, {
includeWriteOnly: true
})
}
if (typeof initialValue !== "string" && type === "object") {
initialValue = stringify(initialValue)
}