mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Merge branch 'develop' into group/tests
This commit is contained in:
commit
f84962597e
@ -20,6 +20,7 @@ module.exports = ({ models, target, plugin = false }, ctx) => {
|
||||
// Set the default values to model settings.
|
||||
_.defaults(definition, {
|
||||
primaryKey: '_id',
|
||||
primaryKeyType: 'string',
|
||||
});
|
||||
|
||||
if (!plugin) {
|
||||
|
||||
@ -63,7 +63,11 @@ const createYupSchema = (model, { groups }) => {
|
||||
};
|
||||
const createYupSchemaAttribute = (type, validations) => {
|
||||
let schema = yup.mixed();
|
||||
if (['string', 'text', 'email', 'password', 'enumeration'].includes(type)) {
|
||||
if (
|
||||
['string', 'text', 'richtext', 'email', 'password', 'enumeration'].includes(
|
||||
type
|
||||
)
|
||||
) {
|
||||
schema = yup.string();
|
||||
}
|
||||
if (type === 'json') {
|
||||
@ -103,6 +107,7 @@ const createYupSchemaAttribute = (type, validations) => {
|
||||
if (['date', 'datetime'].includes(type)) {
|
||||
schema = yup.date().typeError();
|
||||
}
|
||||
|
||||
Object.keys(validations).forEach(validation => {
|
||||
const validationValue = validations[validation];
|
||||
if (
|
||||
|
||||
@ -58,9 +58,6 @@ module.exports = {
|
||||
return {
|
||||
...pickSchemaFields(contentType),
|
||||
attributes: {
|
||||
[contentType.primaryKey]: {
|
||||
type: contentType.primaryKeyType,
|
||||
},
|
||||
id: {
|
||||
type: contentType.primaryKeyType,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user