mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
fix(AWS API Gateway): Fix request validator triage
This commit is contained in:
parent
9a3f1e6997
commit
cb109dd835
@ -21,7 +21,10 @@ module.exports = {
|
||||
event.http.request &&
|
||||
event.http.request.parameters &&
|
||||
// check if any parameters are marked as required
|
||||
Object.values(event.http.request.parameters || {}).some((x) => x)
|
||||
Object.values(event.http.request.parameters || {}).some((x) => {
|
||||
if (!_.isObject(x)) return x;
|
||||
return x.required != null ? x.required : true;
|
||||
})
|
||||
) {
|
||||
if (!validatorLogicalId) {
|
||||
const requestValidator = this.createRequestValidator();
|
||||
|
||||
@ -47,6 +47,14 @@ functions:
|
||||
parameters:
|
||||
paths:
|
||||
bar: false
|
||||
- http:
|
||||
path: paths-not-required-object
|
||||
method: get
|
||||
request:
|
||||
parameters:
|
||||
paths:
|
||||
bar:
|
||||
required: false
|
||||
- http:
|
||||
path: paths-required
|
||||
method: get
|
||||
|
||||
@ -435,6 +435,7 @@ describe('#compileRequestValidators() - parameters', () => {
|
||||
'querystrings-not-required',
|
||||
'headers-not-required',
|
||||
'paths-not-required',
|
||||
'paths-not-required-object',
|
||||
];
|
||||
|
||||
const withValidator = [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user