curl --location --request POST 'http://jira.local:8080/jira/rest//rest/api/3/expression/analyse' \
--header 'Content-Type: application/json' \
--data-raw '{
"contextVariables": {
"listOfStrings": "List<String>",
"record": "{ a: Number, b: String }",
"value": "User"
},
"expressions": [
"issues.map(issue => issue.properties['\''property_key'\''])"
]
}'
{"results":[{"expression":"analysed expression","errors":[{"line":1,"column":4,"message":"!, -, typeof, (, IDENTIFIER, null, true, false, NUMBER, STRING, TEMPLATE_LITERAL, new, [ or { expected, > encountered.","type":"syntax"},{"message":"Jira expression is too long (1040), limit: 1000 characters","type":"other"},{"message":"Jira expression has too many nodes (150), limit: 100 leaves","type":"other"}],"valid":false},{"expression":"issues.map(i => {idAndKey: [i.id, i.key], summary: i.summary, comments: i.comments})","valid":true,"type":"List<{idAndKey: [Number, String], summary: String, comments: List<Comment>}>","complexity":{"expensiveOperations":"N","variables":{"N":"issues"}}},{"expression":"issues.map(i => i.id > '0')","errors":[{"expression":"i.id > 0","message":"Can't compare Number to String.","type":"type"}],"valid":false,"type":"TypeError"}]}
syntax
Each expression's syntax is checked to ensure the expression can be parsed. Also, syntactic limits are validated. For example, the expression's length.type
EXPERIMENTAL. Each expression is type checked and the final type of the expression inferred. Any type errors that would result in the expression failure at runtime are reported. For example, accessing properties that don't exist or passing the wrong number of arguments to functions. Also performs the syntax check.complexity
EXPERIMENTAL. Determines the formulae for how many expensive operations each expression may execute.issue
or project
, are available in context and sets their type. Use this property to override the default types or provide details of new variables.issue
or project
, are available in context and sets their type. Use this property to override the default types or provide details of new variables.