Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layers schema #8299

Merged
merged 11 commits into from Oct 1, 2020
3 changes: 0 additions & 3 deletions lib/configSchema.js
Expand Up @@ -109,9 +109,6 @@ const schema = {
additionalProperties: false,
},

// TODO: Complete schema, see https://github.com/serverless/serverless/issues/8015
layers: { type: 'object' },

/*
* Modes for config validation:
* - error: the error is thrown
Expand Down
47 changes: 47 additions & 0 deletions lib/plugins/aws/provider/awsProvider.js
Expand Up @@ -504,6 +504,53 @@ class AwsProvider {
},
additionalProperties: false,
},
layers: {
type: 'object',
additionalProperties: {
type: 'object',
properties: {
allowedAccounts: {
type: 'array',
items: {
oneOf: [
{ type: 'integer', minimum: 100000000000, maximum: 999999999999 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today I've turned on automatic coercion with #8319, and having that I believe we no longer need that number definition.

We can also remove the logic which tries to handle eventual numeric input

{
type: 'string',
pattern: '\\d{12}|\\*|arn:(aws[a-zA-Z-]*):iam::\\d{12}:root',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to enclose it with ^ and $

},
],
},
},
compatibleRuntimes: {
type: 'array',
items: { $ref: '#/definitions/awsLambdaRuntime' },
maxItems: 5,
},
description: { type: 'string', maxLength: 256 },
licenseInfo: { type: 'string', maxLength: 512 },
name: {
type: 'string',
minLength: 1,
maxLength: 140,
pattern:
'^((arn:[a-zA-Z0-9-]+:lambda:[a-zA-Z0-9-]+:\\d{12}:layer:[a-zA-Z0-9-_]+)|[a-zA-Z0-9-_]+)$',
},
package: {
type: 'object',
properties: {
artifact: { type: 'string' },
exclude: { type: 'array', items: { type: 'string' } },
include: { type: 'array', items: { type: 'string' } },
},
additionalProperties: false,
},
path: { type: 'string' },
retain: { type: 'boolean' },
},
required: ['path'],
additionalProperties: false,
},
},
resources: {
properties: {
AWSTemplateFormatVersion: {
Expand Down