Merge branch 'features/dynamic-zones' of github.com:strapi/strapi into front/dynamic-zones-ctb

This commit is contained in:
soupette 2019-12-03 15:20:31 +01:00
commit 7b9ae33db0
2 changed files with 31 additions and 2 deletions

View File

@ -43,7 +43,7 @@
},
"body": {
"type": "dynamiczone",
"components": []
"components": ["default.closingperiod", "default.openingtimes"]
},
"description": {
"type": "richtext",

View File

@ -672,7 +672,6 @@ module.exports = {
},
minItems: min,
maxItems: max,
description,
};
} else {
acc.properties[current] = {
@ -681,6 +680,36 @@ module.exports = {
description,
};
}
} else if (type === 'dynamiczone') {
const { components, min, max } = attribute;
const cmps = components.map(component => {
const schema = this.generateMainComponent(
strapi.components[component].attributes,
strapi.components[component].associations
);
return _.merge(
{
properties: {
__component: {
type: 'string',
enum: components,
},
},
},
schema
);
});
acc.properties[current] = {
type: 'array',
items: {
oneOf: cmps,
},
minItems: min,
maxItems: max,
};
} else {
acc.properties[current] = {
type,