mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
fix(core): disallow required on relation fields on schemas
This commit is contained in:
parent
cefa185d29
commit
7b4ac52a49
@ -216,11 +216,6 @@ const createRelationValidator =
|
||||
validator = yup.mixed();
|
||||
}
|
||||
|
||||
validator = addRequiredValidation(createOrUpdate)(validator, {
|
||||
attr: { required: !isDraft && attr.required },
|
||||
updatedAttribute,
|
||||
});
|
||||
|
||||
return validator;
|
||||
};
|
||||
|
||||
|
||||
@ -158,6 +158,13 @@ export const transformAttribute = (
|
||||
},
|
||||
};
|
||||
}
|
||||
case 'relation': {
|
||||
if (attribute.required) {
|
||||
throw new Error(
|
||||
`Required relations are not supported, please remove it from ${contentType.collectionName} schema on the attribute ${name}`
|
||||
);
|
||||
}
|
||||
}
|
||||
default: {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user