Complex expression with struct produces error
Closed this issue · 4 comments
I've noticed there is a error searching with struct using a complex expression, where as the map[string]interface{} form parses correctly using jpgo
.
In aws/aws-sdk-go#457 we discovered an expression and input which searches correctly with jpgo, but fails if the same input values are applied to our ECS.DescribeServicesOutput
struct.
The expression being used is:
services | [@[?length(deployments)!=`1`], @[?desiredCount!=runningCount]][] | length(@) == `0`
The error returned from jsmespath.Search
is:
Invalid type for: <nil>, expected: []jmespath.jpType{"string", "array", "object"` ...
This comment has a example JSON input which is marshaled to our ECS.DescribeServicesOutput
struct.
I'm pretty sure the problem lies in functions.go
, as this is one of the only waiters that uses functions. I think it needs a round of generalization similar to what was done in interpreter.go. I think it still assumes map[string]interface{}
for objects.
Looks like this is resolved by #18. The associated case in the AWS SDK for Go no longer fails, and returns the expected value with this PR.