feat(Config Schema): Async invocations AWS functions[] schema (#8385)

This commit is contained in:
Frédéric Barthelet 2020-10-13 10:27:07 +02:00 committed by GitHub
parent 9303d8ecd4
commit 719fa3a3bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class ConfigSchemaHandler {
validateConfig(userConfig) {
if (this.serverless.service.provider.name === 'aws') {
// TODO: Remove after provider is fully covered, see https://github.com/serverless/serverless/issues/8022
this.serverless.configSchemaHandler.relaxProviderSchema();
this.serverless.configSchemaHandler.relaxAwsProviderSchema();
}
if (!this.schema.properties.provider.properties.name) {
@ -221,6 +221,25 @@ class ConfigSchemaHandler {
});
}
relaxAwsProviderSchema() {
// provider
this.schema.properties.provider.additionalProperties = true;
// functions[].events[]
if (
Array.isArray(
this.schema.properties.functions.patternProperties[FUNCTION_NAME_PATTERN].properties.events
.items.anyOf
) &&
this.schema.properties.functions.patternProperties[FUNCTION_NAME_PATTERN].properties.events
.items.anyOf.length === 1
) {
this.schema.properties.functions.patternProperties[
FUNCTION_NAME_PATTERN
].properties.events.items = {};
}
}
relaxProviderSchema() {
// provider
this.schema.properties.provider.additionalProperties = true;

View File

@ -671,6 +671,14 @@ class AwsProvider {
condition: { $ref: '#/definitions/awsResourceCondition' },
dependsOn: { $ref: '#/definitions/awsResourceDependsOn' },
description: { type: 'string', maxLength: 256 },
destinations: {
type: 'object',
properties: {
onSuccess: { type: 'string', minLength: 1 },
onFailure: { type: 'string', minLength: 1 },
},
additionalProperties: false,
},
disableLogs: { type: 'boolean' },
environment: { $ref: '#/definitions/awsLambdaEnvironment' },
fileSystemConfig: {
@ -696,6 +704,8 @@ class AwsProvider {
handler: { type: 'string' },
kmsKeyArn: { $ref: '#/definitions/awsKmsArn' },
layers: { $ref: '#/definitions/awsLambdaLayers' },
maximumEventAge: { type: 'integer', minimum: 60, maximum: 21600 },
maximumRetryAttempts: { type: 'integer', minimum: 0, maximum: 2 },
memorySize: { $ref: '#/definitions/awsLambdaMemorySize' },
onError: {
oneOf: [