Skip to content

Commit

Permalink
MAT-8074 fixed error message for argument section
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-prateekkeerthi committed Dec 31, 2024
1 parent cd24d70 commit 9ee177b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export default function ArgumentSection(props: ArgumentsProps) {
value = formik.values.other;
}
const fnToAdd = {
argumentName: formik.values.argumentName,
argumentName: formik.values.argumentName.includes(" ")
? `"${formik.values.argumentName.trim()}"`
: formik.values.argumentName.trim(),
dataType: value,
};
addArgumentToFunctionsArguments(fnToAdd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export default function FunctionBuilder({
}
: () => {
const functionToApply = {
functionName: formik.values.functionName,
functionName: formik.values.functionName.trim(),
comment: formik.values.comment,
functionsArguments: formik.values.functionsArguments,
fluentFunction: formik.values.fluentFunction,
Expand Down
2 changes: 1 addition & 1 deletion src/validations/FunctionArgumentSchemaValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Yup from "yup";

export const FunctionArgumentSchemaValidator = Yup.object().shape({
argumentName: Yup.string().matches(
/^[a-zA-Z0-9_]*$/,
/^(?!\s+$)[a-zA-Z0-9_ ]+$/,
"No spaces or special characters besides underscore are allowed"
),
dataType: Yup.string(),
Expand Down
4 changes: 3 additions & 1 deletion src/validations/FunctionSectionSchemaValidator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as Yup from "yup";

export const FunctionSectionSchemaValidator = Yup.object().shape({
functionName: Yup.string().required("Function name is required"),
functionName: Yup.string()
.matches(/^(?!\s+$)[a-zA-Z0-9_ ]+$/, "Function name is required")
.required("Function name is required"),
comment: Yup.string(),
fluentFunction: Yup.boolean(),
body: Yup.string(),
Expand Down

0 comments on commit 9ee177b

Please sign in to comment.