fix: multipart array sample generation for items (#6461)
* json schema array component should use schema to generate example in case of array items. * empty value checkbox should be disabled if not empty => not empty list || not empty string * curl should also check for not empty list
This commit is contained in:
@@ -145,10 +145,14 @@ const RequestBody = ({
|
||||
|
||||
let initialValue = prop.get("default") || prop.get("example") || ""
|
||||
|
||||
if (initialValue === "" && type === "object") {
|
||||
initialValue = getSampleSchema(prop, false, {
|
||||
includeWriteOnly: true
|
||||
})
|
||||
if (initialValue === "") {
|
||||
if(type === "object") {
|
||||
initialValue = getSampleSchema(prop, false, {
|
||||
includeWriteOnly: true
|
||||
})
|
||||
} else if(type === "array") {
|
||||
initialValue = []
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof initialValue !== "string" && type === "object") {
|
||||
@@ -193,7 +197,7 @@ const RequestBody = ({
|
||||
onChange={(value) => onChangeIncludeEmpty(key, value)}
|
||||
isIncluded={requestBodyInclusionSetting.get(key) || false}
|
||||
isIncludedOptions={setIsIncludedOptions(key)}
|
||||
isDisabled={!isEmptyValue(currentValue)}
|
||||
isDisabled={Array.isArray(currentValue) ? currentValue.length !== 0 : !isEmptyValue(currentValue)}
|
||||
/>
|
||||
)}
|
||||
</div> : null }
|
||||
|
||||
@@ -416,7 +416,10 @@ export const executeRequest = (req) =>
|
||||
}
|
||||
)
|
||||
.filter(
|
||||
(value, key) => !isEmptyValue(value) || requestBodyInclusionSetting.get(key)
|
||||
(value, key) => (Array.isArray(value)
|
||||
? value.length !== 0
|
||||
: !isEmptyValue(value)
|
||||
) || requestBodyInclusionSetting.get(key)
|
||||
)
|
||||
.toJS()
|
||||
} else{
|
||||
|
||||
Reference in New Issue
Block a user