Skip to content

Commit

Permalink
MAT-7791: partial
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmcphillips committed Dec 10, 2024
1 parent 0c6b6ed commit c55e075
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export default function ArgumentSection(props: ArgumentsProps) {
inputProps={{
"data-testid": "other-type-input",
}}
// required
{...formik.getFieldProps("other")}
error={Boolean(formik.errors.other)}
helperText={formik.errors.other}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ export default function FunctionBuilder({
if (e.target.value && !expressionEditorOpen) {
setExpressionEditorOpen(true);
}
if (e.target.value && !argumentsEditorOpen) {
setArgumentsEditorOpen(true);
}
}}
/>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/validations/FunctionArgumentSchemaValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ export const FunctionArgumentSchemaValidator = Yup.object().shape({
"No spaces or special characters besides underscore are allowed"
),
dataType: Yup.string(),
other: Yup.string(),
other: Yup.string().when("dataType", {
is: (value: any) => value === "Other",
then: (schema) =>
schema.required("This field is required when dataType is 'Other'."),
otherwise: (schema) => schema,
}),
});

0 comments on commit c55e075

Please sign in to comment.