diff --git a/client/src/components/DynamicJsonForm.tsx b/client/src/components/DynamicJsonForm.tsx index a15b57ec5..99a25fc5b 100644 --- a/client/src/components/DynamicJsonForm.tsx +++ b/client/src/components/DynamicJsonForm.tsx @@ -17,6 +17,7 @@ export type JsonSchemaType = { description?: string; properties?: Record; items?: JsonSchemaType; + enum?: string[]; }; type JsonObject = { [key: string]: JsonValue }; diff --git a/client/src/components/StringInput.tsx b/client/src/components/StringInput.tsx new file mode 100644 index 000000000..7ab87553e --- /dev/null +++ b/client/src/components/StringInput.tsx @@ -0,0 +1,51 @@ +import { Textarea } from "@/components/ui/textarea"; +import { JsonSchemaType } from "./DynamicJsonForm"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "./ui/select"; + +interface Props { + id: string; + name: string; + property: JsonSchemaType; + value: string; + onChange: (value: string) => void; +} + +export const StringInput = ({ id, name, property, value, onChange }: Props) => { + if (property.enum?.length) { + return ( + + ); + } + + return ( +