Skip to content

Consistency with the subsection path. #937

Open
@ddaaac

Description

@ddaaac

Hi, I have two JSON string.

{
  "a": {
    "b": [
      {
        "c": "c1"
      }
    ]
  }
}
{
  "a": [
    {
      "b": [
        {
          "c": "c1"
        }
      ]
    }
  ]
}

First one, A(B(List))
responseFields(fieldWithPath("a.b[].c")) <- Test passed.
responseFields(beneathPath("a.b[]"), listOf(fieldWithPath("c"))) <- Test passed.
responseFields(beneathPath("a.b[]"), listOf(fieldWithPath("[].c"))) <- Test failed.

Second one, A(List<B(List)>)
responseFields(fieldWithPath("a[].b[].c")) <- Test passed.
responseFields(beneathPath("a[].b[]"), listOf(fieldWithPath("c"))) <- Test failed.
responseFields(beneathPath("a[].b[]"), listOf(fieldWithPath("[].c"))) <- Test passed.

Is this intentional? Does the way to find the path change if there is an array in the root?


Additional information.

responseFields(fieldWithPath("a.b[].c[].d")) <- Test passed.
responseFields(beneathPath("a.b[].c[]"), listOf(fieldWithPath("d"))) <- Test failed.
responseFields(beneathPath("a.b[].c[]"), listOf(fieldWithPath("[].d"))) <- Test Passed.

responseFields(fieldWithPath("a.b[].c.d")) <- Test passed.
responseFields(beneathPath("a.b[].c"), listOf(fieldWithPath("d"))) <- Test Passed.
responseFields(beneathPath("a.b[].c"), listOf(fieldWithPath("[].d"))) <- Test failed.

I think an array of 1 depth behaves differently from an array of n depth(n >= 2).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions