mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 22:54:31 +00:00
Merge pull request #14032 from strapi/fix/populate-dz
Ignore if populating a scalar attribute
This commit is contained in:
commit
d49d687e72
@ -32,6 +32,10 @@ const compo2 = {
|
||||
name: {
|
||||
type: 'string',
|
||||
},
|
||||
category: {
|
||||
// same field name as in compo1 but different type
|
||||
type: 'string',
|
||||
},
|
||||
category_diff: {
|
||||
type: 'relation',
|
||||
relation: 'oneToOne',
|
||||
@ -136,7 +140,7 @@ describe('CM API - Populate dz', () => {
|
||||
},
|
||||
{
|
||||
__component: 'default.compo-b',
|
||||
items: { id: 2, name: 'BBBB', category_diff: data.categories[0].id },
|
||||
items: { id: 2, name: 'BBBB', category_diff: data.categories[0].id, category: 'smthg' },
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -162,6 +166,7 @@ describe('CM API - Populate dz', () => {
|
||||
__component: 'default.compo-b',
|
||||
items: {
|
||||
name: 'BBBB',
|
||||
category: 'smthg',
|
||||
category_diff: {
|
||||
name: 'name',
|
||||
},
|
||||
|
||||
@ -80,7 +80,7 @@ const processPopulate = (populate, ctx) => {
|
||||
}
|
||||
|
||||
if (!types.isRelation(attribute.type)) {
|
||||
throw new Error(`Invalid populate field. Expected a relation, got ${attribute.type}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// make sure id is present for future populate queries
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user