mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 09:56:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			502 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			502 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| const { yup, formatYupErrors } = require('@strapi/utils');
 | |
| 
 | |
| const settingsSchema = yup.object({
 | |
|   sizeOptimization: yup.boolean().required(),
 | |
|   responsiveDimensions: yup.boolean().required(),
 | |
| });
 | |
| 
 | |
| const validateSettings = data => {
 | |
|   return settingsSchema
 | |
|     .validate(data, {
 | |
|       abortEarly: false,
 | |
|     })
 | |
|     .catch(error => {
 | |
|       throw strapi.errors.badRequest('ValidationError', {
 | |
|         errors: formatYupErrors(error),
 | |
|       });
 | |
|     });
 | |
| };
 | |
| 
 | |
| module.exports = validateSettings;
 | 
