Skip to content

Commit

Permalink
Validate json and don't allow null parameter values when running work…
Browse files Browse the repository at this point in the history
…flow (#866)
  • Loading branch information
ykeremy authored Sep 20, 2024
1 parent e9184bc commit 0beb929
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getClient } from "@/api/AxiosClient";
import { WorkflowParameter } from "@/api/types";
import { Form, FormControl, FormField, FormItem } from "@/components/ui/form";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { useMutation, useQueryClient } from "@tanstack/react-query";
Expand All @@ -22,6 +21,7 @@ import fetchToCurl from "fetch-to-curl";
import { apiBaseUrl } from "@/util/env";
import { useApiCredential } from "@/hooks/useApiCredential";
import { copyText } from "@/util/copyText";
import { WorkflowParameter } from "./types/workflowTypes";

type Props = {
workflowParameters: Array<WorkflowParameter>;
Expand Down Expand Up @@ -152,6 +152,9 @@ function RunWorkflowForm({ workflowParameters, initialValues }: Props) {
return "Invalid JSON";
}
}
if (value === null) {
return "This field is required";
}
},
}}
render={({ field }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { getClient } from "@/api/AxiosClient";
import { WorkflowApiResponse, WorkflowParameterValueType } from "@/api/types";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { useQuery } from "@tanstack/react-query";
import { useLocation, useParams } from "react-router-dom";
import { RunWorkflowForm } from "./RunWorkflowForm";
import {
WorkflowApiResponse,
WorkflowParameterValueType,
} from "./types/workflowTypes";

function defaultValue(type: WorkflowParameterValueType) {
switch (type) {
Expand Down

0 comments on commit 0beb929

Please sign in to comment.