mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-26 18:03:27 +01:00
Merge pull request #857 from snippetkid/855-fix-yup-schema-validation
Address validation issue in Yup schema
This commit is contained in:
commit
b633fc58d2
@ -38,7 +38,9 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
|
|||||||
return !['collection', 'folder'].includes(trimmedValue);
|
return !['collection', 'folder'].includes(trimmedValue);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
curlCommand: Yup.string()
|
curlCommand: Yup.string().when('requestType', {
|
||||||
|
is: (requestType) => requestType === 'from-curl',
|
||||||
|
then: Yup.string()
|
||||||
.min(1, 'must be at least 1 character')
|
.min(1, 'must be at least 1 character')
|
||||||
.required('curlCommand is required')
|
.required('curlCommand is required')
|
||||||
.test({
|
.test({
|
||||||
@ -46,6 +48,7 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
|
|||||||
message: `Invalid cURL Command`,
|
message: `Invalid cURL Command`,
|
||||||
test: (value) => getRequestFromCurlCommand(value) !== null
|
test: (value) => getRequestFromCurlCommand(value) !== null
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
if (isEphemeral) {
|
if (isEphemeral) {
|
||||||
|
Loading…
Reference in New Issue
Block a user