apigee / apigeelint

Static code analysis for Apigee proxy bundles to encourage API developers to use best practices and avoid anti-patterns.
Apache License 2.0
92 stars 71 forks source link

Template validation added in pr https://github.com/apigee/apigeelint/pull/383 is incorrect #386

Closed edekok-mimecast closed 12 months ago

edekok-mimecast commented 12 months ago

The code dos not seem to work with a JSON template e.g.

<Template>
{
   "field": "{some.value}"
}
</Template>

Change in lib/package/plugins/PO026-assignVariableUsage.js lines 127-130 are causing valid templates to fail

if ( ! pluginUtil.isValidTemplate(templateText)) {
  addMessage(textnode[0].lineNumber, textnode[0].columnNumber,
           "The text of the Template element must be a valid message template");
}

due to lib/package/plugins/_pluginUtil.js: isValidTemplate not expecting { when in STATES.INSIDE_CURLY:

ssvaidyanathan commented 12 months ago

@DinoChiesa - FYI

DinoChiesa commented 12 months ago

Ack. This is fixed in #385

ssvaidyanathan commented 12 months ago

Fixed and released in v2.42.0 Please test and let us know