mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +00:00 
			
		
		
		
	
						commit
						454f666b11
					
				@ -212,13 +212,6 @@ const createYupSchema = (
 | 
			
		||||
const createYupSchemaAttribute = (type, validations, options) => {
 | 
			
		||||
  let schema = yup.mixed();
 | 
			
		||||
 | 
			
		||||
  let regex = get(validations, 'regex', null);
 | 
			
		||||
  delete validations.regex;
 | 
			
		||||
 | 
			
		||||
  if (regex) {
 | 
			
		||||
    validations.regex = new RegExp(regex);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (['string', 'uid', 'text', 'richtext', 'email', 'password', 'enumeration'].includes(type)) {
 | 
			
		||||
    schema = yup.string();
 | 
			
		||||
  }
 | 
			
		||||
@ -341,7 +334,7 @@ const createYupSchemaAttribute = (type, validations, options) => {
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
        case 'regex':
 | 
			
		||||
          schema = schema.matches(validationValue, errorsTrads.regex);
 | 
			
		||||
          schema = schema.matches(new RegExp(validationValue), errorsTrads.regex);
 | 
			
		||||
          break;
 | 
			
		||||
        case 'lowercase':
 | 
			
		||||
          if (['text', 'textarea', 'email', 'string'].includes(type)) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user