Skip to content

Commit cbcaf53

Browse files
committed
chore: fix linting error
1 parent 31218b6 commit cbcaf53

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

lib/apiGateway/schema.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@ const customErrorBuilder = (type, message) => (errors) => {
1414
return errors
1515
}
1616

17-
// e.g. errorObject is { type1: message1, type2: message2 }
18-
const customMultipleErrorBuilder = (errorObject) => (errors) => {
19-
for (const error of errors) {
20-
if (_.hasIn(errorObject, error.type)) {
21-
error.message = errorObject[error.type]
22-
}
23-
}
24-
return errors
25-
}
26-
2717
const Joi = require('@hapi/joi')
2818

2919
const path = Joi.string().required()
@@ -175,7 +165,6 @@ const dynamodbDefaultKeyScheme = Joi.object()
175165
)
176166
)
177167

178-
179168
const request = Joi.object({
180169
template: Joi.object().required()
181170
})
@@ -214,7 +203,9 @@ const proxiesSchemas = {
214203
}),
215204
dynamodb: Joi.object({
216205
dynamodb: proxy.append({
217-
action: Joi.string().valid(allowedDynamodbActions).required(),
206+
action: Joi.string()
207+
.valid(allowedDynamodbActions)
208+
.required(),
218209
tableName: stringOrRef.required(),
219210
condition: Joi.string(),
220211
hashKey: dynamodbDefaultKeyScheme.required(),

lib/apiGateway/validate.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ describe('#validateServiceProxies()', () => {
16071607
tableName: 'yourTable',
16081608
path: 'dynamodb',
16091609
method: 'post',
1610-
action: 'PutItem',
1610+
action: 'PutItem'
16111611
}
16121612
}
16131613
]

lib/package/dynamodb/compileMethodsToDynamodb.test.js

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ describe('#compileMethodsToDynamodb()', () => {
255255
]
256256
}
257257
testPutItem(
258-
{ hashKey: { pathParam: 'id', attributeType: 'S' }, path: '/dynamodb/{id}', action: 'PutItem' },
258+
{
259+
hashKey: { pathParam: 'id', attributeType: 'S' },
260+
path: '/dynamodb/{id}',
261+
action: 'PutItem'
262+
},
259263
{
260264
'application/json': intRequestTemplate,
261265
'application/x-www-form-urlencoded': intRequestTemplate
@@ -279,7 +283,11 @@ describe('#compileMethodsToDynamodb()', () => {
279283
]
280284
}
281285
testPutItem(
282-
{ hashKey: { queryStringParam: 'id', attributeType: 'S' }, path: '/dynamodb', action: 'PutItem' },
286+
{
287+
hashKey: { queryStringParam: 'id', attributeType: 'S' },
288+
path: '/dynamodb',
289+
action: 'PutItem'
290+
},
283291
{
284292
'application/json': intRequestTemplate,
285293
'application/x-www-form-urlencoded': intRequestTemplate
@@ -405,7 +413,11 @@ describe('#compileMethodsToDynamodb()', () => {
405413
const intResponseTemplate =
406414
'#set($item = $input.path(\'$.Item\')){#foreach($key in $item.keySet())#set ($value = $item.get($key))#foreach( $type in $value.keySet())"$key":"$value.get($type)"#if($foreach.hasNext()),#end#end#if($foreach.hasNext()),#end#end}'
407415
testGetItem(
408-
{ hashKey: { pathParam: 'id', attributeType: 'S' }, path: '/dynamodb/{id}', action: 'GetItem' },
416+
{
417+
hashKey: { pathParam: 'id', attributeType: 'S' },
418+
path: '/dynamodb/{id}',
419+
action: 'GetItem'
420+
},
409421
{
410422
'application/json': intRequestTemplate,
411423
'application/x-www-form-urlencoded': intRequestTemplate
@@ -434,7 +446,11 @@ describe('#compileMethodsToDynamodb()', () => {
434446
const intResponseTemplate =
435447
'#set($item = $input.path(\'$.Item\')){#foreach($key in $item.keySet())#set ($value = $item.get($key))#foreach( $type in $value.keySet())"$key":"$value.get($type)"#if($foreach.hasNext()),#end#end#if($foreach.hasNext()),#end#end}'
436448
testGetItem(
437-
{ hashKey: { queryStringParam: 'id', attributeType: 'S' }, path: '/dynamodb', action: 'GetItem' },
449+
{
450+
hashKey: { queryStringParam: 'id', attributeType: 'S' },
451+
path: '/dynamodb',
452+
action: 'GetItem'
453+
},
438454
{
439455
'application/json': intRequestTemplate,
440456
'application/x-www-form-urlencoded': intRequestTemplate
@@ -538,7 +554,11 @@ describe('#compileMethodsToDynamodb()', () => {
538554
}
539555

540556
testDeleteItem(
541-
{ hashKey: { pathParam: 'id', attributeType: 'S' }, path: '/dynamodb/{id}', action: 'DeleteItem' },
557+
{
558+
hashKey: { pathParam: 'id', attributeType: 'S' },
559+
path: '/dynamodb/{id}',
560+
action: 'DeleteItem'
561+
},
542562
{
543563
'application/json': intRequestTemplate,
544564
'application/x-www-form-urlencoded': intRequestTemplate
@@ -563,7 +583,11 @@ describe('#compileMethodsToDynamodb()', () => {
563583
}
564584

565585
testDeleteItem(
566-
{ hashKey: { queryStringParam: 'id', attributeType: 'S' }, path: '/dynamodb/{id}', action: 'DeleteItem' },
586+
{
587+
hashKey: { queryStringParam: 'id', attributeType: 'S' },
588+
path: '/dynamodb/{id}',
589+
action: 'DeleteItem'
590+
},
567591
{
568592
'application/json': intRequestTemplate,
569593
'application/x-www-form-urlencoded': intRequestTemplate
@@ -805,7 +829,8 @@ describe('#compileMethodsToDynamodb()', () => {
805829
const testAuthorization = (auth) => {
806830
const param = {
807831
hashKey: {
808-
pathParam: 'id', attributeType: 'S'
832+
pathParam: 'id',
833+
attributeType: 'S'
809834
},
810835
action: 'PutItem',
811836
auth

0 commit comments

Comments
 (0)