+ {prop.type === "boolean" ? (
+
+
+ setParams({
+ ...params,
+ [key]: checked,
+ })
+ }
+ />
+
+
+ ) : prop.type === "string" && prop.enum ? (
+
+ ) : prop.type === "string" ? (
+
- ) : (
-
- (formRefs.current[key] = ref)}
- schema={{
- type: prop.type,
- properties: prop.properties,
- description: prop.description,
- items: prop.items,
- }}
- value={params[key] as JsonValue}
- onChange={(newValue: JsonValue) => {
- setParams({
- ...params,
- [key]: newValue,
- });
- // Check validation after a short delay to allow form to update
- setTimeout(checkValidationErrors, 100);
+ onChange={(e) => {
+ const value = e.target.value;
+ if (value === "") {
+ // Field cleared - set to undefined
+ setParams({
+ ...params,
+ [key]: undefined,
+ });
+ } else {
+ // Field has value - keep as string
+ setParams({
+ ...params,
+ [key]: value,
+ });
+ }
}}
+ className="mt-1"
/>
-
- )}
+ ) : prop.type === "object" ||
+ prop.type === "array" ? (
+
+ (formRefs.current[key] = ref)}
+ schema={{
+ type: prop.type,
+ properties: prop.properties,
+ description: prop.description,
+ items: prop.items,
+ }}
+ value={
+ (params[key] as JsonValue) ??
+ generateDefaultValue(prop)
+ }
+ onChange={(newValue: JsonValue) => {
+ setParams({
+ ...params,
+ [key]: newValue,
+ });
+ // Check validation after a short delay to allow form to update
+ setTimeout(checkValidationErrors, 100);
+ }}
+ />
+
+ ) : prop.type === "number" ||
+ prop.type === "integer" ? (
+
{
+ const value = e.target.value;
+ if (value === "") {
+ // Field cleared - set to undefined
+ setParams({
+ ...params,
+ [key]: undefined,
+ });
+ } else {
+ // Field has value - try to convert to number, but store input either way
+ const num = Number(value);
+ if (!isNaN(num)) {
+ setParams({
+ ...params,
+ [key]: num,
+ });
+ } else {
+ // Store invalid input as string - let server validate
+ setParams({
+ ...params,
+ [key]: value,
+ });
+ }
+ }
+ }}
+ className="mt-1"
+ />
+ ) : (
+
+ (formRefs.current[key] = ref)}
+ schema={{
+ type: prop.type,
+ properties: prop.properties,
+ description: prop.description,
+ items: prop.items,
+ }}
+ value={params[key] as JsonValue}
+ onChange={(newValue: JsonValue) => {
+ setParams({
+ ...params,
+ [key]: newValue,
+ });
+ // Check validation after a short delay to allow form to update
+ setTimeout(checkValidationErrors, 100);
+ }}
+ />
+
+ )}
+