changed to validators (#23250)

fixes: #23180
This commit is contained in:
Erik Jan de Wit 2023-09-25 07:19:54 +02:00 committed by GitHub
parent d8ff73e34f
commit a584ff94a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@ export const OptionComponent = (attr: UserProfileAttribute) => {
const isMultiSelect = type.includes("multiselect");
const Component = isMultiSelect ? Checkbox : Radio;
const options = (attr.validations?.options as Options).options || [];
const options = (attr.validators?.options as Options).options || [];
return (
<UserProfileGroup {...attr}>

View file

@ -41,7 +41,7 @@ export const SelectComponent = (attribute: UserProfileFieldsProps) => {
};
const options =
(attribute.validations?.options as Options | undefined)?.options || [];
(attribute.validators?.options as Options | undefined)?.options || [];
const optionLabel = attribute.annotations?.[
"inputOptionLabels"

View file

@ -19,8 +19,7 @@ type LengthValidator =
const isRequired = (attribute: UserProfileAttribute) =>
Object.keys(attribute.required || {}).length !== 0 ||
(((attribute.validations?.length as LengthValidator)?.min as number) || 0) >
0;
(((attribute.validators?.length as LengthValidator)?.min as number) || 0) > 0;
export const UserProfileGroup = ({
children,

View file

@ -8,6 +8,7 @@ export default interface UserProfileConfig {
export interface UserProfileAttribute {
name?: string;
validations?: Record<string, unknown>;
validators?: Record<string, unknown>;
annotations?: Record<string, unknown>;
required?: UserProfileAttributeRequired;
readOnly?: boolean;