go-apiops icon indicating copy to clipboard operation
go-apiops copied to clipboard

Conditional logic for JSONPath selectors not working

Open mark-sivill-kong opened this issue 1 year ago • 2 comments

When applying conditional logic for a plugin using deck file add-plugins, only the first piece of logic is matched and applied.

Using the command

cat ./kong-simple-config.json | deck file add-plugins --format json ./get-post-route-plugins.yaml

Plugins are only applied to GET routes not POST routes, the selectors JSONPath is

$.services[*].routes[?(@.methods[?(@=='GET' ) || (@=='POST')])]

get-post-route-plugins.yaml.txt get-route-plugins.yaml.txt kong-simple-config.json

mark-sivill-kong avatar Oct 24 '24 13:10 mark-sivill-kong

Filed upstream issue here: https://github.com/vmware-labs/yaml-jsonpath/issues/60

rspurgeon avatar Oct 24 '24 20:10 rspurgeon

Alternative library: https://github.com/speakeasy-api/jsonpath

mheap avatar Jan 09 '25 17:01 mheap