Skip to content

Commit

Permalink
Merge pull request #857 from snippetkid/855-fix-yup-schema-validation
Browse files Browse the repository at this point in the history
Address validation issue in Yup schema
  • Loading branch information
helloanoop authored Nov 2, 2023
2 parents 9cf8a58 + 09d6bc8 commit b633fc5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/bruno-app/src/components/Sidebar/NewRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b633fc5

Please sign in to comment.