How to use the strapi-helper-plugin.translatedErrors.required function in strapi-helper-plugin

To help you get started, we’ve selected a few strapi-helper-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditView / utils / schema.js View on Github external
yup.addMethod(yup.mixed, 'defined', function() {
  return this.test(
    'defined',
    errorsTrads.required,
    value => value !== undefined
  );
});
github strapi / strapi / packages / strapi-plugin-content-type-builder / admin / src / containers / FormModal / utils / forms.js View on Github external
yup.addMethod(yup.mixed, 'defined', function() {
  return this.test(
    'defined',
    errorsTrads.required,
    value => value !== undefined
  );
});
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditViewDataManagerProvider / utils / schema.js View on Github external
yup.addMethod(yup.mixed, 'defined', function() {
  return this.test(
    'defined',
    errorsTrads.required,
    value => value !== undefined
  );
});
github strapi / strapi / packages / strapi-admin / admin / src / containers / AuthPage / forms.js View on Github external
name: 'news',
          type: 'checkbox',
          value: false,
        },
      ],
    ],
    schema: yup.object({
      email: yup
        .string()
        .email(translatedErrors.email)
        .required(translatedErrors.required),
      username: yup.string().required(translatedErrors.required),
      password: yup
        .string()
        .min(6, translatedErrors.minLength)
        .required(translatedErrors.required),
      passwordConfirmation: yup
        .string()
        .min(6, translatedErrors.minLength)
        .oneOf(
          [yup.ref('password'), null],
          'components.Input.error.password.noMatch'
        )
        .required(translatedErrors.required),
    }),
  },
  'reset-password': {
    endPoint: 'reset-password',
    inputs: [
      [
        {
          name: 'password',
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditView / utils / schema.js View on Github external
Object.keys(validations).forEach(validation => {
    const validationValue = validations[validation];
    if (
      !!validationValue ||
      ((!isBoolean(validationValue) &&
        Number.isInteger(Math.floor(validationValue))) ||
        validationValue === 0)
    ) {
      switch (validation) {
        case 'required':
          schema = schema.required(errorsTrads.required);
          break;
        case 'max':
          schema = schema.max(validationValue, errorsTrads.max);
          break;
        case 'maxLength':
          schema = schema.max(validationValue, errorsTrads.maxLength);
          break;
        case 'min':
          schema = schema.min(validationValue, errorsTrads.min);
          break;
        case 'minLength':
          schema = schema.min(validationValue, errorsTrads.minLength);
          break;
        case 'regex':
          schema = schema.matches(validationValue, errorsTrads.regex);
          break;
github strapi / strapi / packages / strapi-admin / admin / src / containers / AuthPage / forms.js View on Github external
[
        {
          label: {
            id: 'Auth.form.forgot-password.email.label',
          },
          name: 'email',
          type: 'email',
          placeholder: 'Auth.form.forgot-password.email.placeholder',
        },
      ],
    ],
    schema: yup.object({
      email: yup
        .string()
        .email(translatedErrors.email)
        .required(translatedErrors.required),
    }),
  },
  login: {
    endPoint: 'local',
    inputs: [
      [
        {
          label: {
            id: 'Auth.form.login.username.label',
          },
          name: 'identifier',
          type: 'text',
          placeholder: 'Auth.form.login.username.placeholder',
        },
      ],
      [
github strapi / strapi / packages / strapi-plugin-content-type-builder / admin / src / containers / FormModal / utils / forms.js View on Github external
return yup.object().shape({
        name: yup
          .string()
          .unique(
            errorsTrads.unique,
            takenNames,
            createComponentUid,
            componentCategory
          )
          .isAllowed(getTrad('error.contentTypeName.reserved-name'))
          .required(errorsTrads.required),
        category: yup
          .string()
          .matches(CATEGORY_NAME_REGEX, errorsTrads.regex)
          .required(errorsTrads.required),
        icon: yup.string().required(errorsTrads.required),
        collectionName: yup.string().nullable(),
      });
    },
    form: {
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditViewDataManagerProvider / utils / schema.js View on Github external
if (attribute.type === 'dynamiczone') {
        let dynamicZoneSchema = yup.array().of(
          yup.lazy(({ __component }) => {
            return createYupSchema(components[__component], { components });
          })
        );

        const { max, min } = attribute;

        if (attribute.required) {
          dynamicZoneSchema = dynamicZoneSchema.required();

          if (min) {
            dynamicZoneSchema = dynamicZoneSchema
              .min(min, errorsTrads.min)
              .required(errorsTrads.required);
          }
        } else {
          if (min) {
            dynamicZoneSchema = dynamicZoneSchema.notEmptyMin(min);
          }
        }

        if (max) {
          dynamicZoneSchema = dynamicZoneSchema.max(max, errorsTrads.max);
        }

        acc[current] = dynamicZoneSchema;
      }

      return acc;
    }, {})