Skip to content

Cannot parse index selector using the dot notation unless it is the last segment in a path expression #7

@sophiecollard

Description

@sophiecollard

When used in the last segment of a path expression, an index selector using the dot notation is parsed correctly:

Parser.run JsonPath.Parser.path "$.*.foo.0" ==
    Ok [ Children Wildcard, Children (Keys "foo" []), Children (Indices 0 [])]

Parser.run JsonPath.Parser.path "$.*.foo..1,2,3" ==
    Ok [ Children Wildcard, Children (Keys "foo" []), Descendants (Indices 1 [ 2, 3 ])]

When used in any other position in the path expression however, it results in a parsing error:

Parser.run JsonPath.Parser.path "$.*.0.foo" ==
    Err [{ col = 5, problem = ExpectingInt, row = 1 }]

Parser.run JsonPath.Parser.path "$.*..1,2,3.foo" ==
    Err [{ col = 10, problem = ExpectingInt, row = 1 }]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions