mirror of
https://github.com/strapi/strapi.git
synced 2025-07-06 16:42:29 +00:00
Support dynamic zones in documentation plugin
This commit is contained in:
parent
46c32055cf
commit
d901b54c2e
@ -43,7 +43,7 @@
|
|||||||
},
|
},
|
||||||
"body": {
|
"body": {
|
||||||
"type": "dynamiczone",
|
"type": "dynamiczone",
|
||||||
"components": []
|
"components": ["default.closingperiod", "default.openingtimes"]
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "richtext",
|
"type": "richtext",
|
||||||
|
@ -672,7 +672,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
minItems: min,
|
minItems: min,
|
||||||
maxItems: max,
|
maxItems: max,
|
||||||
description,
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
acc.properties[current] = {
|
acc.properties[current] = {
|
||||||
@ -681,6 +680,36 @@ module.exports = {
|
|||||||
description,
|
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 {
|
} else {
|
||||||
acc.properties[current] = {
|
acc.properties[current] = {
|
||||||
type,
|
type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user