Skip to content

Commit 2a0e699

Browse files
authored
Updates version of asl service, allows users to replace arn values with placeholders (#1103)
New version of asl service relaxes requirement for Resource property of task state. It will accept any string now. Removed filter removing arn errors for visualisation validation as it is no longer necessary. From now, any additional properties that are not in ASL specification will be marked as invalid. Authored-by: Alan Bogusiewicz <[email protected]>
1 parent 6829f10 commit 2a0e699

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Step Functions Linter: Resource property of Task state will accept any string instead of just arn. Additional disallowed properties will be marked as invalid."
4+
}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@
914914
},
915915
"dependencies": {
916916
"adm-zip": "^0.4.13",
917-
"amazon-states-language-service": "^1.0.2",
917+
"amazon-states-language-service": "^1.1.0",
918918
"async-lock": "^1.1.3",
919919
"aws-sdk": "^2.581.0",
920920
"cloudformation-schema-js-yaml": "^1.0.1",

src/stepFunctions/utils.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export const VISUALIZATION_CSS_URL = 'https://do0of8uwbahzz.cloudfront.net/graph
3030
export const SCRIPTS_LAST_DOWNLOADED_URL = 'SCRIPT_LAST_DOWNLOADED_URL'
3131
export const CSS_LAST_DOWNLOADED_URL = 'CSS_LAST_DOWNLOADED_URL'
3232

33-
export const ARN_REGEX_STRING = String.raw`^arn:aws([a-z]|\-)*:(states|lambda):([a-z]|\d|\-)*:([0-9]{12})?:.+:.+$`
34-
3533
export interface UpdateCachedScriptOptions {
3634
globalStorage: vscode.Memento
3735
lastDownloadedURLKey: string
@@ -194,10 +192,7 @@ export async function isDocumentValid(textDocument?: vscode.TextDocument): Promi
194192
const doc = ASLTextDocument.create(textDocument.uri.path, textDocument.languageId, textDocument.version, text)
195193
// tslint:disable-next-line: no-inferred-empty-object-type
196194
const jsonDocument = languageService.parseJSONDocument(doc)
197-
const diagnostics = (await languageService.doValidation(doc, jsonDocument, documentSettings))
198-
// Invalid ARN strings shouldn't prevent rendering of the state machine graph
199-
.filter(diagnostic => !diagnostic.message.includes(ARN_REGEX_STRING))
200-
195+
const diagnostics = await languageService.doValidation(doc, jsonDocument, documentSettings)
201196
const isValid = !diagnostics.some(diagnostic => diagnostic.severity === DiagnosticSeverity.Error)
202197

203198
return isValid

0 commit comments

Comments
 (0)