Merge branch 'develop' into group/tests

This commit is contained in:
Alexandre BODIN 2019-08-09 15:45:05 +02:00 committed by GitHub
commit f84962597e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -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) {

View File

@ -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 (

View File

@ -58,9 +58,6 @@ module.exports = {
return {
...pickSchemaFields(contentType),
attributes: {
[contentType.primaryKey]: {
type: contentType.primaryKeyType,
},
id: {
type: contentType.primaryKeyType,
},