Skip to content

Complex expression with struct produces error #14

Closed

Description

@jasdel

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.

Activity

  1. jamesls commented on Dec 10, 2015

    @jamesls
    Member

    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.

  2. jasdel commented on Feb 2, 2016

    @jasdel
    ContributorAuthor

    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.

  3. jamesls commented on Feb 2, 2016

    @jamesls
    Member

    I'm going to go ahead and merge in #18 to unblock this specific issue.

    I'll then go ahead and audit all the existing functions and update as necessary in a follow up PR.

  4. jamesls commented on Feb 2, 2016

    @jamesls
    Member

    Fixed in #18. Will create a follow up tracking issue for the remaining work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions