Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/deploy/stepFunctions/compileAlarms.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const _ = require('lodash');
const BbPromise = require('bluebird');
const Joi = require('@hapi/joi');
const schema = require('./compileAlarms.schema');
const logger = require('../../utils/logger');

Expand Down Expand Up @@ -142,7 +141,7 @@ function validateConfig(serverless, stateMachineName, alarmsObj) {
return false;
}

const { error } = Joi.validate(alarmsObj, schema, { allowUnknown: false });
const { error } = schema.validate(alarmsObj, { allowUnknown: false });

if (error) {
logger.log(
Expand Down
10 changes: 5 additions & 5 deletions lib/deploy/stepFunctions/compileAlarms.schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');

const arn = Joi.alternatives().try(
Joi.string(),
Expand All @@ -15,15 +15,15 @@ const arn = Joi.alternatives().try(
),
}),
Joi.object().keys({
'Fn::Join': Joi.array().items([
'Fn::Join': Joi.array().items(
Joi.string(),
Joi.array().items([
Joi.array().items(
Joi.string(),
Joi.object().keys({
Ref: Joi.string(),
}),
]),
]),
),
),
}),
);

Expand Down
5 changes: 2 additions & 3 deletions lib/deploy/stepFunctions/compileNotifications.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const _ = require('lodash');
const Joi = require('@hapi/joi');
const crypto = require('crypto');
const BbPromise = require('bluebird');
const schema = require('./compileNotifications.schema');
Expand Down Expand Up @@ -326,8 +325,8 @@ function validateConfig(serverless, stateMachineName, stateMachineObj, notificat
return false;
}

const { error } = Joi.validate(
notificationsObj, schema, { allowUnknown: false },
const { error } = schema.validate(
notificationsObj, { allowUnknown: false },
);

if (error) {
Expand Down
10 changes: 5 additions & 5 deletions lib/deploy/stepFunctions/compileNotifications.schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');

const arn = Joi.alternatives().try(
Joi.string(),
Expand All @@ -9,15 +9,15 @@ const arn = Joi.alternatives().try(
'Fn::GetAtt': Joi.array().items(Joi.string()),
}),
Joi.object().keys({
'Fn::Join': Joi.array().items([
'Fn::Join': Joi.array().items(
Joi.string(),
Joi.array().items([
Joi.array().items(
Joi.string(),
Joi.object().keys({
Ref: Joi.string(),
}),
]),
]),
),
),
}),
);

Expand Down
4 changes: 1 addition & 3 deletions lib/deploy/stepFunctions/compileStateMachines.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const _ = require('lodash');
const Joi = require('@hapi/joi');
const aslValidator = require('asl-validator');
const BbPromise = require('bluebird');
const crypto = require('crypto');
Expand Down Expand Up @@ -107,8 +106,7 @@ module.exports = {
} else {
Tags = toTags(this.serverless.service.provider.tags);
}

const { error, value } = Joi.validate(stateMachineObj, schema, { allowUnknown: false });
const { error, value } = schema.validate(stateMachineObj, { allowUnknown: false });
if (error) {
const errorMessage = `State machine [${stateMachineName}] is malformed. `
+ 'Please check the README for more info. '
Expand Down
10 changes: 5 additions & 5 deletions lib/deploy/stepFunctions/compileStateMachines.schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');

const arn = Joi.alternatives().try(
Joi.string().regex(/^arn:aws/, 'ARN'),
Expand All @@ -15,15 +15,15 @@ const arn = Joi.alternatives().try(
),
}),
Joi.object().keys({
'Fn::Join': Joi.array().items([
'Fn::Join': Joi.array().items(
Joi.string(),
Joi.array().items([
Joi.array().items(
Joi.string(),
Joi.object().keys({
Ref: Joi.string(),
}),
]),
]),
),
),
}),
);

Expand Down
Loading