Skip to content

Commit c951bcf

Browse files
fix: only add schema check for newer versions of sls
1 parent c658c29 commit c951bcf

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

lib/index.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,23 @@ class ServerlessStepFunctions {
141141
.then(this.display),
142142
};
143143

144-
const stepFunctionsSchema = {
145-
type: 'object',
146-
properties: {
147-
stateMachines: { type: 'object' },
148-
validate: { type: 'boolean' },
149-
noOutput: { type: 'boolean' },
150-
activities: { type: 'array' },
151-
},
152-
required: ['stateMachines'],
153-
};
154-
this.serverless.configSchemaHandler.defineTopLevelProperty(
155-
'stepFunctions',
156-
stepFunctionsSchema,
157-
);
144+
// relevant since sls v1.78.0
145+
if (this.serverless.configSchemaHandler) {
146+
const stepFunctionsSchema = {
147+
type: 'object',
148+
properties: {
149+
stateMachines: { type: 'object' },
150+
validate: { type: 'boolean' },
151+
noOutput: { type: 'boolean' },
152+
activities: { type: 'array' },
153+
},
154+
required: ['stateMachines'],
155+
};
156+
this.serverless.configSchemaHandler.defineTopLevelProperty(
157+
'stepFunctions',
158+
stepFunctionsSchema,
159+
);
160+
}
158161
}
159162

160163
invoke() {

0 commit comments

Comments
 (0)