mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
warn if bad value
This commit is contained in:
parent
965ae8acec
commit
e2eef30453
@ -5,6 +5,7 @@ const BbPromise = require('bluebird');
|
||||
const fs = BbPromise.promisifyAll(require('fs'));
|
||||
const _ = require('lodash');
|
||||
const os = require('os');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const findKeyChain = (astContent) => {
|
||||
let content = astContent;
|
||||
@ -24,6 +25,11 @@ const parseAST = (ymlAstContent, astObject) => {
|
||||
let newAstObject = astObject || {};
|
||||
if (ymlAstContent.mappings && _.isArray(ymlAstContent.mappings)) {
|
||||
_.forEach(ymlAstContent.mappings, (v) => {
|
||||
if (!v.value) {
|
||||
console.log(`Serverless: ${chalk.red(`Your serverless.yml has an invalid value with key: ${v.key.value}. Ignoring...`)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (v.key.kind === 0 && v.value.kind === 0) {
|
||||
newAstObject[findKeyChain(v)] = v.value;
|
||||
} else if (v.key.kind === 0 && v.value.kind === 2) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user