mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
fix: address validation issue in schema
This commit is contained in:
parent
9cf8a584a0
commit
09d6bc8169
@ -38,14 +38,17 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
|
||||
return !['collection', 'folder'].includes(trimmedValue);
|
||||
}
|
||||
}),
|
||||
curlCommand: Yup.string()
|
||||
.min(1, 'must be at least 1 character')
|
||||
.required('curlCommand is required')
|
||||
.test({
|
||||
name: 'curlCommand',
|
||||
message: `Invalid cURL Command`,
|
||||
test: (value) => getRequestFromCurlCommand(value) !== null
|
||||
})
|
||||
curlCommand: Yup.string().when('requestType', {
|
||||
is: (requestType) => requestType === 'from-curl',
|
||||
then: Yup.string()
|
||||
.min(1, 'must be at least 1 character')
|
||||
.required('curlCommand is required')
|
||||
.test({
|
||||
name: 'curlCommand',
|
||||
message: `Invalid cURL Command`,
|
||||
test: (value) => getRequestFromCurlCommand(value) !== null
|
||||
})
|
||||
})
|
||||
}),
|
||||
onSubmit: (values) => {
|
||||
if (isEphemeral) {
|
||||
|
Loading…
Reference in New Issue
Block a user