mirror of
https://github.com/strapi/strapi.git
synced 2025-07-06 00:21:18 +00:00
Support dynamic zones in documentation plugin
This commit is contained in:
parent
46c32055cf
commit
d901b54c2e
@ -43,7 +43,7 @@
|
||||
},
|
||||
"body": {
|
||||
"type": "dynamiczone",
|
||||
"components": []
|
||||
"components": ["default.closingperiod", "default.openingtimes"]
|
||||
},
|
||||
"description": {
|
||||
"type": "richtext",
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user