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
93 stars 71 forks source link

PO003 error when using ExtractVariable policy to extract from json payload stored in runtime variable. #296

Closed jmbreed closed 2 years ago

jmbreed commented 2 years ago

Lint Version: 2.15 Lint Error: PO003 Error - An appropriate check for a message body was not found on the enclosing Step or Flow.

I have a context variable that is set during our PreProxy FH that stores a json object string obtained from a kvm. During proxy runtime the ExtractVariable policy parses values from the json in the context variable to individual variables. The condition in the flow on the ExtractVariable policy is to make sure the context variable is not null (eg. private.geis.kvm.api.config != null).

The Error I'm getting seems to indicate that the ExtractPolicy needs to have a condition to make sure the message body is not null. However, in my use case I am not parsing from the message content but from a runtime variable. This was not an error in version prior to 2.12. Can someone please let me know if this is a bug or if ExtractVariable policies are only intended to be used to parse payloads in the message content.

Thanks! Jeffrey

DinoChiesa commented 2 years ago

That's a a bug. ExtractVariables can be used to parse any JSON. I'll look into it.

ssvaidyanathan commented 2 years ago

Released as v2.16.0