upgrade yup to 0.32.9 (#10487)

This commit is contained in:
Pierre Noël 2021-06-17 09:55:32 +02:00 committed by GitHub
parent 0ab3503e3c
commit d66a49f23c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 43 additions and 42 deletions

View File

@ -8,7 +8,10 @@ const schema = yup.object().shape({
.string()
.email(translatedErrors.email)
.required(translatedErrors.required),
roles: yup.array().required(translatedErrors.required),
roles: yup
.array()
.min(1, translatedErrors.min)
.required(translatedErrors.required),
});
export default schema;

View File

@ -29,7 +29,10 @@ const schema = yup.object().shape({
})
);
}),
events: yup.array().required(translatedErrors.required),
events: yup
.array()
.min(1, translatedErrors.min)
.required(translatedErrors.required),
});
export default schema;

View File

@ -2,7 +2,10 @@ import * as yup from 'yup';
import { translatedErrors } from 'strapi-helper-plugin';
const schema = {
roles: yup.array().required(translatedErrors.required),
roles: yup
.array()
.min(1)
.required(translatedErrors.required),
};
export default schema;

View File

@ -112,7 +112,7 @@
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2",
"webpackbar": "^4.0.0",
"yup": "^0.28.2"
"yup": "^0.32.9"
},
"author": {
"name": "Strapi",

View File

@ -5,7 +5,6 @@ const validators = require('./common-validators');
const registerProviderActionSchema = yup
.array()
.requiredAllowEmpty()
.required()
.of(
yup
@ -32,7 +31,7 @@ const registerProviderActionSchema = yup
then: yup
.array()
.of(yup.string())
.requiredAllowEmpty(),
.required(),
otherwise: yup
.mixed()
.oneOf([undefined], 'subjects should only be defined for the "contentTypes" section'),

View File

@ -97,7 +97,7 @@ const updatePermissions = yup
.shape({
permissions: yup
.array()
.requiredAllowEmpty()
.required()
.of(
yup
.object()

View File

@ -47,7 +47,7 @@
"sanitize-html": "2.3.3",
"strapi-helper-plugin": "3.6.3",
"strapi-utils": "3.6.3",
"yup": "^0.28.2"
"yup": "^0.32.9"
},
"author": {
"name": "Strapi team",

View File

@ -33,7 +33,7 @@
"strapi-generate-api": "3.6.3",
"strapi-helper-plugin": "3.6.3",
"strapi-utils": "3.6.3",
"yup": "^0.28.2"
"yup": "^0.32.9"
},
"author": {
"name": "Strapi team",

View File

@ -235,7 +235,7 @@ describe('CRUD locales', () => {
expect(res.statusCode).toBe(400);
expect(res.body).toMatchObject({
data: {
undefined: ['this field has unspecified keys: code'],
'': ['this field has unspecified keys: code'],
},
error: 'Bad Request',
message: 'ValidationError',
@ -258,7 +258,7 @@ describe('CRUD locales', () => {
expect(res.statusCode).toBe(400);
expect(res.body).toMatchObject({
data: {
undefined: ['this field has unspecified keys: code'],
'': ['this field has unspecified keys: code'],
},
error: 'Bad Request',
message: 'ValidationError',

View File

@ -16,13 +16,8 @@ function isNotNull(msg = '${path} cannot be null.') {
return this.test('defined', msg, isNotNullTest);
}
function arrayRequiredAllowEmpty(message = '${path} is required') {
return this.test('field is required', message, value => _.isArray(value));
}
yup.addMethod(yup.mixed, 'notNil', isNotNill);
yup.addMethod(yup.mixed, 'notNull', isNotNull);
yup.addMethod(yup.array, 'requiredAllowEmpty', arrayRequiredAllowEmpty);
class StrapiIDSchema extends MixedSchemaType {
constructor() {

View File

@ -19,7 +19,7 @@
"lodash": "4.17.21",
"pino": "^4.7.1",
"pluralize": "^8.0.0",
"yup": "^0.28.2"
"yup": "^0.32.9"
},
"author": {
"email": "hi@strapi.io",

View File

@ -982,13 +982,6 @@
dependencies:
regenerator-runtime "^0.13.4"
"@babel/runtime@^7.9.6":
version "7.14.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.0.tgz#46794bc20b612c5f75e62dd071e24dfd95f1cbe6"
integrity sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA==
dependencies:
regenerator-runtime "^0.13.4"
"@babel/template@^7.12.13", "@babel/template@^7.3.3":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327"
@ -3545,6 +3538,11 @@
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==
"@types/lodash@^4.14.165":
version "4.14.170"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.170.tgz#0d67711d4bf7f4ca5147e9091b847479b87925d6"
integrity sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==
"@types/long@^4.0.0":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9"
@ -8908,11 +8906,6 @@ fn-name@~2.0.1:
resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-2.0.1.tgz#5214d7537a4d06a4a301c0cc262feb84188002e7"
integrity sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=
fn-name@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-3.0.0.tgz#0596707f635929634d791f452309ab41558e3c5c"
integrity sha512-eNMNr5exLoavuAMhIUVsOKF79SWd/zG104ef6sxBTSw+cZc6BXdQXDvYcGvp0VbxVVSp1XDUNoz7mg1xMtSznA==
follow-redirects@^1.0.0, follow-redirects@^1.10.0:
version "1.13.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267"
@ -12621,7 +12614,7 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
lodash-es@^4.17.11, lodash-es@^4.17.14:
lodash-es@^4.17.14, lodash-es@^4.17.15:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
@ -13945,6 +13938,11 @@ nano-time@1.0.0:
dependencies:
big-integer "^1.6.16"
nanoclone@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/nanoclone/-/nanoclone-0.2.1.tgz#dd4090f8f1a110d26bb32c49ed2f5b9235209ed4"
integrity sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==
nanoid@^3.1.22:
version "3.1.22"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.22.tgz#b35f8fb7d151990a8aebd5aa5015c03cf726f844"
@ -16105,7 +16103,7 @@ property-expr@^1.5.0:
resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-1.5.1.tgz#22e8706894a0c8e28d58735804f6ba3a3673314f"
integrity sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g==
property-expr@^2.0.2:
property-expr@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-2.0.4.tgz#37b925478e58965031bb612ec5b3260f8241e910"
integrity sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg==
@ -19440,7 +19438,7 @@ symbol-tree@^3.2.4:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
synchronous-promise@^2.0.10, synchronous-promise@^2.0.6:
synchronous-promise@^2.0.6:
version "2.0.15"
resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.15.tgz#07ca1822b9de0001f5ff73595f3d08c4f720eb8e"
integrity sha512-k8uzYIkIVwmT+TcglpdN50pS2y1BDcUnBPK9iJeGu0Pl1lOI8pD6wtzgw91Pjpe+RxtTncw32tLxs/R0yNL2Mg==
@ -21193,17 +21191,17 @@ yup@^0.27.0:
synchronous-promise "^2.0.6"
toposort "^2.0.2"
yup@^0.28.2:
version "0.28.5"
resolved "https://registry.yarnpkg.com/yup/-/yup-0.28.5.tgz#85cabb4000d3623ef69be81551190692e631a8a5"
integrity sha512-7JZcvpUGUxMKoaEtcoMEM8lCWRaueGNH/A3EhL/UWqfbFm3uloiI+x59Yq4nzhbbYWUTwAsCteaZOJ+VbqI1uw==
yup@^0.32.9:
version "0.32.9"
resolved "https://registry.yarnpkg.com/yup/-/yup-0.32.9.tgz#9367bec6b1b0e39211ecbca598702e106019d872"
integrity sha512-Ci1qN+i2H0XpY7syDQ0k5zKQ/DoxO0LzPg8PAR/X4Mpj6DqaeCoIYEEjDJwhArh3Fa7GWbQQVDZKeXYlSH4JMg==
dependencies:
"@babel/runtime" "^7.9.6"
fn-name "~3.0.0"
lodash "^4.17.15"
lodash-es "^4.17.11"
property-expr "^2.0.2"
synchronous-promise "^2.0.10"
"@babel/runtime" "^7.10.5"
"@types/lodash" "^4.14.165"
lodash "^4.17.20"
lodash-es "^4.17.15"
nanoclone "^0.2.1"
property-expr "^2.0.4"
toposort "^2.0.2"
zen-observable-ts@^0.8.21: