How to use the strapi-helper-plugin.translatedErrors.json 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
const createYupSchemaAttribute = (type, validations) => {
  let schema = yup.mixed();
  if (
    ['string', 'text', 'richtext', 'email', 'password', 'enumeration'].includes(
      type
    )
  ) {
    schema = yup.string();
  }
  if (type === 'json') {
    schema = yup
      .mixed(errorsTrads.json)
      .test('isJSON', errorsTrads.json, value => {
        if (value === undefined) {
          return true;
        }

        try {
          JSON.parse(value);
          return true;
        } catch (err) {
          return false;
        }
      })
      .nullable();
  }

  if (type === 'email') {
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditViewDataManagerProvider / utils / schema.js View on Github external
const createYupSchemaAttribute = (type, validations) => {
  let schema = yup.mixed();

  if (
    ['string', 'text', 'richtext', 'email', 'password', 'enumeration'].includes(
      type
    )
  ) {
    schema = yup.string();
  }

  if (type === 'json') {
    schema = yup
      .mixed(errorsTrads.json)
      .test('isJSON', errorsTrads.json, value => {
        if (value === undefined) {
          return true;
        }

        if (
          isNumber(value) ||
          isNull(value) ||
          isObject(value) ||
          isArray(value)
        ) {
          return true;
        }

        try {
          JSON.parse(value);
          return true;
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditViewDataManagerProvider / utils / schema.js View on Github external
const createYupSchemaAttribute = (type, validations) => {
  let schema = yup.mixed();

  if (
    ['string', 'text', 'richtext', 'email', 'password', 'enumeration'].includes(
      type
    )
  ) {
    schema = yup.string();
  }

  if (type === 'json') {
    schema = yup
      .mixed(errorsTrads.json)
      .test('isJSON', errorsTrads.json, value => {
        if (value === undefined) {
          return true;
        }

        if (
          isNumber(value) ||
          isNull(value) ||
          isObject(value) ||
          isArray(value)
        ) {
          return true;
        }

        try {
          JSON.parse(value);
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditView / utils / schema.js View on Github external
const createYupSchemaAttribute = (type, validations) => {
  let schema = yup.mixed();
  if (
    ['string', 'text', 'richtext', 'email', 'password', 'enumeration'].includes(
      type
    )
  ) {
    schema = yup.string();
  }
  if (type === 'json') {
    schema = yup
      .mixed(errorsTrads.json)
      .test('isJSON', errorsTrads.json, value => {
        if (value === undefined) {
          return true;
        }

        try {
          JSON.parse(value);
          return true;
        } catch (err) {
          return false;
        }
      })
      .nullable();
  }

  if (type === 'email') {
    schema = schema.email(errorsTrads.email);