Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update front-end to treat fields with default values as required #3694

Merged
merged 10 commits into from
Jun 29, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ const ConnectorParametersForm: React.FC<ConnectorParametersFormProps> = ({
name={key}
key={key}
validate={
secretsSchema?.required?.includes(key) || item.type === "integer"
secretsSchema?.required?.includes(key) ||
Object.prototype.hasOwnProperty.call(
galvana marked this conversation as resolved.
Show resolved Hide resolved
secretsSchema?.properties[key],
"default"
) ||
item.type === "integer"
? (value: string) =>
validateField(item.title, value, item.allOf?.[0].$ref)
: false
Expand All @@ -151,7 +156,13 @@ const ConnectorParametersForm: React.FC<ConnectorParametersFormProps> = ({
{({ field, form }: { field: FieldInputProps<string>; form: any }) => (
<FormControl
display="flex"
isRequired={secretsSchema?.required?.includes(key)}
isRequired={
secretsSchema?.required?.includes(key) ||
Object.prototype.hasOwnProperty.call(
secretsSchema?.properties[key],
"default"
)
}
isInvalid={form.errors[key] && form.touched[key]}
>
{getFormLabel(key, item.title)}
Expand Down