diff --git a/examples/getstarted/api/restaurant/models/Restaurant.settings.json b/examples/getstarted/api/restaurant/models/Restaurant.settings.json index c31ba63ab7..91b1ef5d76 100755 --- a/examples/getstarted/api/restaurant/models/Restaurant.settings.json +++ b/examples/getstarted/api/restaurant/models/Restaurant.settings.json @@ -43,7 +43,7 @@ }, "body": { "type": "dynamiczone", - "components": [] + "components": ["default.closingperiod", "default.openingtimes"] }, "description": { "type": "richtext", diff --git a/packages/strapi-plugin-documentation/services/Documentation.js b/packages/strapi-plugin-documentation/services/Documentation.js index 1610bf431b..a457ad6ba8 100755 --- a/packages/strapi-plugin-documentation/services/Documentation.js +++ b/packages/strapi-plugin-documentation/services/Documentation.js @@ -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,