mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
Chore: Remove component icon validation from backend
This commit is contained in:
parent
287787a550
commit
4d4c3e90cd
@ -28,7 +28,6 @@ describe('Component validator', () => {
|
||||
component: {
|
||||
category: 'default',
|
||||
displayName: 'mycompo',
|
||||
icon: 'american-sign-language-interpreting',
|
||||
attributes: {
|
||||
title: {
|
||||
type: 'string',
|
||||
@ -50,7 +49,6 @@ describe('Component validator', () => {
|
||||
component: {
|
||||
category: 'default',
|
||||
displayName: 'mycompo',
|
||||
icon: 'american-sign-language-interpreting',
|
||||
attributes: {
|
||||
title: {
|
||||
type: 'string',
|
||||
@ -74,7 +72,6 @@ describe('Component validator', () => {
|
||||
component: {
|
||||
category: 'default',
|
||||
displayName: 'mycompo',
|
||||
icon: 'american-sign-language-interpreting',
|
||||
attributes: {
|
||||
title: {
|
||||
type: 'string',
|
||||
|
||||
@ -122,7 +122,6 @@ describe('Content type validator', () => {
|
||||
components: [
|
||||
{
|
||||
uid: 'edit',
|
||||
icon: 'star',
|
||||
displayName: 'test',
|
||||
category: 'test',
|
||||
attributes: {
|
||||
@ -134,7 +133,6 @@ describe('Content type validator', () => {
|
||||
},
|
||||
{
|
||||
tmpUID: 'random',
|
||||
icon: 'star',
|
||||
displayName: 'test2',
|
||||
category: 'test',
|
||||
attributes: {
|
||||
|
||||
@ -13,7 +13,6 @@ const validators = {
|
||||
const NAME_REGEX = /^[A-Za-z][_0-9A-Za-z]*$/;
|
||||
const COLLECTION_NAME_REGEX = /^[A-Za-z][-_0-9A-Za-z]*$/;
|
||||
const CATEGORY_NAME_REGEX = /^[A-Za-z][-_0-9A-Za-z]*$/;
|
||||
const ICON_REGEX = /^[A-Za-z0-9][-A-Za-z0-9]*$/;
|
||||
const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
|
||||
|
||||
const isValidName = {
|
||||
@ -40,12 +39,6 @@ const isValidCollectionName = {
|
||||
test: (val) => val === '' || COLLECTION_NAME_REGEX.test(val),
|
||||
};
|
||||
|
||||
const isValidIcon = {
|
||||
name: 'isValidIcon',
|
||||
message: `\${path} must match the following regex: ${ICON_REGEX}`,
|
||||
test: (val) => val === '' || ICON_REGEX.test(val),
|
||||
};
|
||||
|
||||
const isValidKey = (key) => ({
|
||||
name: 'isValidKey',
|
||||
message: `Attribute name '${key}' must match the following regex: ${NAME_REGEX}`,
|
||||
@ -103,7 +96,6 @@ module.exports = {
|
||||
isValidCategoryName,
|
||||
isValidDefaultJSON,
|
||||
isValidName,
|
||||
isValidIcon,
|
||||
isValidKey,
|
||||
isValidEnum,
|
||||
isValidUID,
|
||||
|
||||
@ -4,7 +4,7 @@ const _ = require('lodash');
|
||||
const { yup, validateYupSchema } = require('@strapi/utils');
|
||||
|
||||
const { modelTypes, DEFAULT_TYPES } = require('../../services/constants');
|
||||
const { isValidCategoryName, isValidIcon } = require('./common');
|
||||
const { isValidCategoryName } = require('./common');
|
||||
const createSchema = require('./model-schema');
|
||||
const { removeEmptyDefaults } = require('./data-transform');
|
||||
|
||||
@ -16,7 +16,6 @@ const componentSchema = createSchema(VALID_TYPES, VALID_RELATIONS, {
|
||||
})
|
||||
.shape({
|
||||
displayName: yup.string().min(1).required('displayName.required'),
|
||||
icon: yup.string().nullable().test(isValidIcon),
|
||||
category: yup.string().nullable().test(isValidCategoryName).required('category.required'),
|
||||
})
|
||||
.required()
|
||||
|
||||
@ -18,7 +18,6 @@ const formatComponent = (component) => {
|
||||
category,
|
||||
apiId: modelName,
|
||||
schema: {
|
||||
icon: _.get(info, 'icon'),
|
||||
displayName: _.get(info, 'displayName'),
|
||||
description: _.get(info, 'description', ''),
|
||||
connection,
|
||||
|
||||
@ -51,7 +51,6 @@ module.exports = function createComponentBuilder() {
|
||||
.setUID(uid)
|
||||
.set('collectionName', collectionName)
|
||||
.set(['info', 'displayName'], infos.displayName)
|
||||
.set(['info', 'icon'], infos.icon)
|
||||
.set(['info', 'description'], infos.description)
|
||||
.set('pluginOptions', infos.pluginOptions)
|
||||
.set('config', infos.config)
|
||||
@ -101,7 +100,6 @@ module.exports = function createComponentBuilder() {
|
||||
.setUID(newUID)
|
||||
.setDir(newDir)
|
||||
.set(['info', 'displayName'], infos.displayName)
|
||||
.set(['info', 'icon'], infos.icon)
|
||||
.set(['info', 'description'], infos.description)
|
||||
.set('pluginOptions', infos.pluginOptions)
|
||||
.setAttributes(this.convertAttributes(newAttributes));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user