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

fix: issue 352, new plugin for extractVariables hygiene #391

Closed DinoChiesa closed 11 months ago

DinoChiesa commented 11 months ago

This is a new plugin that fixes issue #352.

It checks for the specific problem Kurt mentioned as well as others in the ExtractVariables policy.

NB: the example Kurt gave showed a type of "String" that works in Apigee but not in Apigee-X. The type "String" is not rejected outright by Apigee, but it is invalid nonetheless. It happens to fail in a benign way, in that the default is "string". So if you used

<ExtractVariables name="EV-Type-foo">
    <JSONPayload>
        <Variable name="oauth_error" type="foo">
            <JSONPath>$.error</JSONPath>
        </Variable>
    </JSONPayload>
    <Source clearPayload="false">response</Source>
</ExtractVariables>

...(old) Apigee might not reject it at deploy time, but the extracted variable would be of type "string".

In Apigee X and hybrid, the control plane is more strict.