Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit baf6764

Browse files
authored
Merge pull request serverless-operations#558 from kuhiga/joi-upgrade
chore: upgrade @hapi/joi to joi
2 parents 6696431 + 75de507 commit baf6764

8 files changed

+592
-17232
lines changed

lib/deploy/stepFunctions/compileAlarms.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const _ = require('lodash');
44
const BbPromise = require('bluebird');
5-
const Joi = require('@hapi/joi');
65
const schema = require('./compileAlarms.schema');
76
const logger = require('../../utils/logger');
87

@@ -142,7 +141,7 @@ function validateConfig(serverless, stateMachineName, alarmsObj) {
142141
return false;
143142
}
144143

145-
const { error } = Joi.validate(alarmsObj, schema, { allowUnknown: false });
144+
const { error } = schema.validate(alarmsObj, { allowUnknown: false });
146145

147146
if (error) {
148147
logger.log(

lib/deploy/stepFunctions/compileAlarms.schema.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Joi = require('@hapi/joi');
1+
const Joi = require('joi');
22

33
const arn = Joi.alternatives().try(
44
Joi.string(),
@@ -15,15 +15,15 @@ const arn = Joi.alternatives().try(
1515
),
1616
}),
1717
Joi.object().keys({
18-
'Fn::Join': Joi.array().items([
18+
'Fn::Join': Joi.array().items(
1919
Joi.string(),
20-
Joi.array().items([
20+
Joi.array().items(
2121
Joi.string(),
2222
Joi.object().keys({
2323
Ref: Joi.string(),
2424
}),
25-
]),
26-
]),
25+
),
26+
),
2727
}),
2828
);
2929

lib/deploy/stepFunctions/compileNotifications.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const _ = require('lodash');
4-
const Joi = require('@hapi/joi');
54
const crypto = require('crypto');
65
const BbPromise = require('bluebird');
76
const schema = require('./compileNotifications.schema');
@@ -326,8 +325,8 @@ function validateConfig(serverless, stateMachineName, stateMachineObj, notificat
326325
return false;
327326
}
328327

329-
const { error } = Joi.validate(
330-
notificationsObj, schema, { allowUnknown: false },
328+
const { error } = schema.validate(
329+
notificationsObj, { allowUnknown: false },
331330
);
332331

333332
if (error) {

lib/deploy/stepFunctions/compileNotifications.schema.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Joi = require('@hapi/joi');
1+
const Joi = require('joi');
22

33
const arn = Joi.alternatives().try(
44
Joi.string(),
@@ -9,15 +9,15 @@ const arn = Joi.alternatives().try(
99
'Fn::GetAtt': Joi.array().items(Joi.string()),
1010
}),
1111
Joi.object().keys({
12-
'Fn::Join': Joi.array().items([
12+
'Fn::Join': Joi.array().items(
1313
Joi.string(),
14-
Joi.array().items([
14+
Joi.array().items(
1515
Joi.string(),
1616
Joi.object().keys({
1717
Ref: Joi.string(),
1818
}),
19-
]),
20-
]),
19+
),
20+
),
2121
}),
2222
);
2323

lib/deploy/stepFunctions/compileStateMachines.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const _ = require('lodash');
4-
const Joi = require('@hapi/joi');
54
const aslValidator = require('asl-validator');
65
const BbPromise = require('bluebird');
76
const crypto = require('crypto');
@@ -107,8 +106,7 @@ module.exports = {
107106
} else {
108107
Tags = toTags(this.serverless.service.provider.tags);
109108
}
110-
111-
const { error, value } = Joi.validate(stateMachineObj, schema, { allowUnknown: false });
109+
const { error, value } = schema.validate(stateMachineObj, { allowUnknown: false });
112110
if (error) {
113111
const errorMessage = `State machine [${stateMachineName}] is malformed. `
114112
+ 'Please check the README for more info. '

lib/deploy/stepFunctions/compileStateMachines.schema.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Joi = require('@hapi/joi');
1+
const Joi = require('joi');
22

33
const arn = Joi.alternatives().try(
44
Joi.string().regex(/^arn:aws/, 'ARN'),
@@ -15,15 +15,15 @@ const arn = Joi.alternatives().try(
1515
),
1616
}),
1717
Joi.object().keys({
18-
'Fn::Join': Joi.array().items([
18+
'Fn::Join': Joi.array().items(
1919
Joi.string(),
20-
Joi.array().items([
20+
Joi.array().items(
2121
Joi.string(),
2222
Joi.object().keys({
2323
Ref: Joi.string(),
2424
}),
25-
]),
26-
]),
25+
),
26+
),
2727
}),
2828
);
2929

0 commit comments

Comments
 (0)