Skip to content

Commit

Permalink
feat: Remove support for object notation for service
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Object notation is no longer supported for `service` property.
Set name directly to `service`.
  • Loading branch information
pgrzesik authored and medikoo committed Jan 27, 2022
1 parent f86f691 commit bccd188
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
10 changes: 3 additions & 7 deletions lib/classes/Service.js
Expand Up @@ -91,13 +91,10 @@ class Service {

// `service` (read by dashboard plugin)
if (_.isObject(configurationInput.service)) {
this.serverless._logDeprecation(
'SERVICE_OBJECT_NOTATION',
'Starting from next major object notation for "service" property will no longer be ' +
'recognized. Set "service" property directly with service name.'
throw new ServerlessError(
'Object notation for "service" property is not supported. Set "service" property directly with service name.',
'SERVICE_OBJECT_NOTATION'
);
this.serviceObject = configurationInput.service;
this.service = configurationInput.service.name;
} else {
this.serviceObject = { name: configurationInput.service };
this.service = configurationInput.service;
Expand Down Expand Up @@ -276,7 +273,6 @@ class Service {

validate() {
const userConfig = this.initialServerlessConfig;
userConfig.service = this.serviceObject;

// Ensure to validate normalized (after mergeArrays) input
if (userConfig.functions) userConfig.functions = this.functions;
Expand Down
15 changes: 1 addition & 14 deletions lib/configSchema.js
Expand Up @@ -114,20 +114,7 @@ const schema = {
required: ['name'],
additionalProperties: false,
},
service: {
anyOf: [
{ $ref: '#/definitions/serviceName' },
{
type: 'object',
properties: {
name: { $ref: '#/definitions/serviceName' },
awsKmsKeyArn: { $ref: '#/definitions/awsKmsArn' },
},
additionalProperties: false,
required: ['name'],
},
],
},
service: { $ref: '#/definitions/serviceName' },
unresolvedVariablesNotificationMode: { enum: ['error', 'warn'] },
useDotenv: { const: true },
variablesResolutionMode: { type: 'string', enum: ['20210219', '20210326'] },
Expand Down

0 comments on commit bccd188

Please sign in to comment.