amazon-states-language-service
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -9,2 +9,3 @@ /*! | ||
readonly INVALID_START_AT: "The value of \"StartAt\" property must be the name of an existing state."; | ||
readonly INVALID_JSON_PATH: "The value for the field must be a valid JSONPath."; | ||
readonly UNREACHABLE_STATE: "The state cannot be reached. It must be referenced by at least one other state."; | ||
@@ -11,0 +12,0 @@ readonly NO_TERMINAL_STATE: "No terminal state. The state machine must have at least one terminal state (a state in which the \"End\" property is set to true)."; |
@@ -11,7 +11,8 @@ "use strict"; | ||
INVALID_START_AT: 'The value of "StartAt" property must be the name of an existing state.', | ||
INVALID_JSON_PATH: 'The value for the field must be a valid JSONPath.', | ||
UNREACHABLE_STATE: 'The state cannot be reached. It must be referenced by at least one other state.', | ||
NO_TERMINAL_STATE: 'No terminal state. The state machine must have at least one terminal state (a state in which the "End" property is set to true).', | ||
INVALID_PROPERTY_NAME: 'Field is not supported.', | ||
MUTUALLY_EXCLUSIVE_CHOICE_PROPERTIES: 'Each Choice Rule can only have one comparison operator.' | ||
MUTUALLY_EXCLUSIVE_CHOICE_PROPERTIES: 'Each Choice Rule can only have one comparison operator.', | ||
}; | ||
//# sourceMappingURL=diagnosticStrings.js.map |
@@ -160,3 +160,3 @@ [ | ||
"\t\t\t\t\t\"Type\": \"Pass\",", | ||
"\t\t\t\t\t\"End\": \"True\"", | ||
"\t\t\t\t\t\"End\": true", | ||
"\t\t\t\t}", | ||
@@ -170,3 +170,3 @@ "\t\t\t}", | ||
"\t\t\t\t\t\"Type\": \"Pass\",", | ||
"\t\t\t\t\t\"End\": \"True\"", | ||
"\t\t\t\t\t\"End\": true", | ||
"\t\t\t\t}", | ||
@@ -194,3 +194,3 @@ "\t\t\t}", | ||
"\t\t\t\t\"Result\": \"Done!\",", | ||
"\t\t\t\t\"End\": \"True\"", | ||
"\t\t\t\t\"End\": true", | ||
"\t\t\t}", | ||
@@ -197,0 +197,0 @@ "\t\t}", |
@@ -26,2 +26,22 @@ "use strict"; | ||
} | ||
function validateParameters(parametersPropNode, document) { | ||
let diagnostics = []; | ||
const valueNode = parametersPropNode.valueNode; | ||
if (astUtilityFunctions_1.isObjectNode(valueNode)) { | ||
valueNode.properties.forEach(prop => { | ||
if (prop.keyNode.value.endsWith('.$')) { | ||
const propValue = prop.valueNode.value; | ||
if (typeof propValue !== 'string' || !propValue.startsWith('$')) { | ||
const { length, offset } = prop.valueNode; | ||
const range = vscode_json_languageservice_1.Range.create(document.positionAt(offset), document.positionAt(offset + length)); | ||
diagnostics.push(vscode_json_languageservice_1.Diagnostic.create(range, diagnosticStrings_1.MESSAGES.INVALID_JSON_PATH, vscode_json_languageservice_1.DiagnosticSeverity.Error)); | ||
} | ||
} | ||
else if (astUtilityFunctions_1.isObjectNode(prop.valueNode)) { | ||
diagnostics = diagnostics.concat(validateParameters(prop, document)); | ||
} | ||
}); | ||
} | ||
return diagnostics; | ||
} | ||
// Validates next property within array of objects | ||
@@ -111,2 +131,16 @@ function validateArrayNext(arrayPropName, oneStateValueNode, stateNames, document) { | ||
} | ||
// Validate Parameters for given state types | ||
if (['Pass', 'Task', 'Parallel', 'Map'].includes(stateType)) { | ||
const parametersPropNode = astUtilityFunctions_1.findPropChildByName(oneStateValueNode, 'Parameters'); | ||
if (parametersPropNode) { | ||
const validateParametersDiagnostics = validateParameters(parametersPropNode, document); | ||
diagnostics = diagnostics.concat(validateParametersDiagnostics); | ||
} | ||
} | ||
// Validate Catch for given state types | ||
if (['Task', 'Parallel', 'Map'].includes(stateType)) { | ||
const validateCatchResult = validateArrayNext('Catch', oneStateValueNode, stateNames, document); | ||
diagnostics = diagnostics.concat(validateCatchResult.diagnostics); | ||
reachedStates = Object.assign(Object.assign({}, reachedStates), validateCatchResult.reachedStates); | ||
} | ||
switch (stateType) { | ||
@@ -125,5 +159,2 @@ // if the type of the state is "Map" recursively run validateStates for its value node | ||
const branchesPropNode = astUtilityFunctions_1.findPropChildByName(oneStateValueNode, 'Branches'); | ||
const validateCatchResult = validateArrayNext('Catch', oneStateValueNode, stateNames, document); | ||
diagnostics = diagnostics.concat(validateCatchResult.diagnostics); | ||
reachedStates = Object.assign(Object.assign({}, reachedStates), validateCatchResult.reachedStates); | ||
if (branchesPropNode && branchesPropNode.valueNode && astUtilityFunctions_1.isArrayNode(branchesPropNode.valueNode)) { | ||
@@ -139,8 +170,2 @@ branchesPropNode.valueNode.children.forEach(branchItem => { | ||
} | ||
case 'Task': { | ||
const validateCatchResult = validateArrayNext('Catch', oneStateValueNode, stateNames, document); | ||
diagnostics = diagnostics.concat(validateCatchResult.diagnostics); | ||
reachedStates = Object.assign(Object.assign({}, reachedStates), validateCatchResult.reachedStates); | ||
break; | ||
} | ||
case 'Choice': { | ||
@@ -147,0 +172,0 @@ const defaultNode = astUtilityFunctions_1.findPropChildByName(oneStateValueNode, 'Default'); |
@@ -139,2 +139,3 @@ /*! | ||
Next: boolean; | ||
Comment: boolean; | ||
}; | ||
@@ -144,2 +145,3 @@ NestedChoiceRule: { | ||
Variable: boolean; | ||
Comment: boolean; | ||
}; | ||
@@ -150,2 +152,3 @@ Catcher: { | ||
Next: boolean; | ||
Comment: boolean; | ||
}; | ||
@@ -157,2 +160,3 @@ Retrier: { | ||
BackoffRate: boolean; | ||
Comment: boolean; | ||
}; | ||
@@ -159,0 +163,0 @@ }; |
@@ -140,3 +140,4 @@ "use strict"; | ||
Variable: true, | ||
Next: true | ||
Next: true, | ||
Comment: true | ||
}, | ||
@@ -146,2 +147,3 @@ NestedChoiceRule: { | ||
Variable: true, | ||
Comment: true | ||
}, | ||
@@ -151,3 +153,4 @@ Catcher: { | ||
ResultPath: true, | ||
Next: true | ||
Next: true, | ||
Comment: true | ||
}, | ||
@@ -158,3 +161,4 @@ Retrier: { | ||
MaxAttempts: true, | ||
BackoffRate: true | ||
BackoffRate: true, | ||
Comment: true | ||
} | ||
@@ -161,0 +165,0 @@ }, |
@@ -15,3 +15,3 @@ { | ||
"license": "MIT", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"publisher": "aws", | ||
@@ -18,0 +18,0 @@ "categories": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168530
2752