You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/11/29 03:10:02 UTC

[GitHub] [james-project] vttranlina opened a new pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

vttranlina opened a new pull request #765:
URL: https://github.com/apache/james-project/pull/765


   https://issues.apache.org/jira/browse/JAMES-3677


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758012001



##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -82,14 +84,14 @@ object JsonPath {
         } else if (arrayElementPartPosition == 0) {
           asArrayElementPart(string)
         } else {
-          asArrayElementInAnObject(string, part, arrayElementPartPosition)
+          asArrayElementInAnObject(part, arrayElementPartPosition)
         }
     })
 
   private def asPlainPart(part: String): List[JsonPathPart] = List(PlainPart(part))
 
-  private def asArrayElementInAnObject(string: String, part: String, arrayElementPartPosition: Int): List[JsonPathPart] =
-    ArrayElementPart.parse(string.substring(arrayElementPartPosition))
+  private def asArrayElementInAnObject(part: String, arrayElementPartPosition: Int): List[JsonPathPart] =
+    ArrayElementPart.parse(part.substring(arrayElementPartPosition))

Review comment:
       I don't sure about this line




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758080077



##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -75,27 +73,8 @@ object JsonPath {
       case "" => Nil
       case "*" => List(WildcardPart)
       case string if ArrayElementPart.parse(string).isDefined => ArrayElementPart.parse(string)
-      case part: String =>
-        val arrayElementPartPosition = part.indexOf('[')
-        if (arrayElementPartPosition < 0) {
-          asPlainPart(part)
-        } else if (arrayElementPartPosition == 0) {
-          asArrayElementPart(string)
-        } else {
-          asArrayElementInAnObject(string, part, arrayElementPartPosition)
-        }
+      case part: String => List(PlainPart(part))

Review comment:
       I think we could change the return type here to `Option` and further simplify things here...
   
   ```
   case string => ArrayElementPart.parse(string)
      .orElse(Some(PlainPart(part)))
   ```

##########
File path: server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/json/BackReferenceTest.scala
##########
@@ -46,26 +46,23 @@ class BackReferenceTest extends AnyWordSpec with Matchers {
   }
 
   "Array element parsing" should {
-    "succeed when poositive" in {
-      ArrayElementPart.parse("[1]") should equal(Some(ArrayElementPart(1)))
+    "succeed when positive" in {
+      ArrayElementPart.parse("1") should equal(Some(ArrayElementPart(1)))
     }
     "succeed when zero" in {
-      ArrayElementPart.parse("[0]") should equal(Some(ArrayElementPart(0)))
+      ArrayElementPart.parse("0") should equal(Some(ArrayElementPart(0)))
+    }
+    "succeed when no bracket" in {
+      ArrayElementPart.parse("0") should equal(Some(ArrayElementPart(0)))
     }
     "fail when negative" in {
-      ArrayElementPart.parse("[-1]") should equal(None)
+      ArrayElementPart.parse("-1") should equal(None)
     }
     "fail when not an int" in {
-      ArrayElementPart.parse("[invalid]") should equal(None)
-    }
-    "fail when not closed" in {
-      ArrayElementPart.parse("[0") should equal(None)
+      ArrayElementPart.parse("invalid") should equal(None)
     }
-    "fail when not open" in {
-      ArrayElementPart.parse("0]") should equal(None)
-    }
-    "fail when no bracket" in {
-      ArrayElementPart.parse("0") should equal(None)
+    "fail when has bracket" in {
+      ArrayElementPart.parse("[0]") should equal(None)

Review comment:
       Test also:
   
   
   `list/id/99999999999999999999999999999999999999999999999999999999999999999999999999999999` 

##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -45,10 +45,8 @@ case class PlainPart(name: String) extends JsonPathPart {
 
 object ArrayElementPart {
   def parse(string: String): Option[ArrayElementPart] = {
-    if (string.startsWith("[") && string.endsWith("]")) {
-      val positionPart: String = string.substring(1, string.length - 1)
-      Try(positionPart.toInt)
-        .fold(_ => None, fromInt)
+    if (string forall Character.isDigit) {
+      fromInt(string.toInt)

Review comment:
       We got read of some error handling here. Are we sure to handle all cases already?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina commented on pull request #765:
URL: https://github.com/apache/james-project/pull/765#issuecomment-981261216


   ## Note: 
   When the part value is number 
   Then part is ArrayElementPart
   
   We can miss case:
   ```json
   {
       "path": [
           {
               "0": "abc"
           }
       ]
   }
   ``` 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #765:
URL: https://github.com/apache/james-project/pull/765#issuecomment-981265127


   Is `list[0]/id` syntax spec compliant in the first place?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758082838



##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -75,27 +73,8 @@ object JsonPath {
       case "" => Nil
       case "*" => List(WildcardPart)
       case string if ArrayElementPart.parse(string).isDefined => ArrayElementPart.parse(string)
-      case part: String =>
-        val arrayElementPartPosition = part.indexOf('[')
-        if (arrayElementPartPosition < 0) {
-          asPlainPart(part)
-        } else if (arrayElementPartPosition == 0) {
-          asArrayElementPart(string)
-        } else {
-          asArrayElementInAnObject(string, part, arrayElementPartPosition)
-        }
+      case part: String => List(PlainPart(part))

Review comment:
       We already have a this case before
   ` case string if ArrayElementPart.parse(string).isDefined` 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa merged pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa merged pull request #765:
URL: https://github.com/apache/james-project/pull/765


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758014137



##########
File path: server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/json/BackReferenceTest.scala
##########
@@ -98,6 +98,29 @@ class BackReferenceTest extends AnyWordSpec with Matchers {
 
       jsonPath.evaluate(json) should equal(JsSuccess(expected))
     }
+    "succeed when first array element is present in second path" in {
+      val jsonPath = JsonPath.parse("path/0")
+      val json = Json.parse("""{"path":[{"id":"1","code":"a"},{"id":"2","code":"b"},{"id":"3","code":"c"}]}""".stripMargin)
+      val expected = Json.parse("""{"id":"1","code":"a"}""")
+
+      jsonPath.evaluate(json) should equal(JsSuccess(expected))
+    }
+    "succeed when pointing to specific array elements and specific path" in {
+      val jsonPath = JsonPath.parse("path/0/id")

Review comment:
       What happen if I go out of bound eg with `path/4/id`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758145097



##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -45,10 +45,8 @@ case class PlainPart(name: String) extends JsonPathPart {
 
 object ArrayElementPart {
   def parse(string: String): Option[ArrayElementPart] = {
-    if (string.startsWith("[") && string.endsWith("]")) {
-      val positionPart: String = string.substring(1, string.length - 1)
-      Try(positionPart.toInt)
-        .fold(_ => None, fromInt)
+    if (string forall Character.isDigit) {
+      fromInt(string.toInt)

Review comment:
       Yes, it has been thrown when "99999999999999999999999999"




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #765:
URL: https://github.com/apache/james-project/pull/765#issuecomment-982275872


   ```
   
   
   org.apache.james.jmap.json.BackReferenceTest.JsonPath evaluation should succeed when first array element is present        Error Details           JsError(List((,List(JsonValidationError(List(Expecting a JsObject but got a different structure),List()))))) did not equal JsSuccess("1",) Stack Trace | 98 ms | 1
   -- | -- | --
   org.apache.james.jmap.json.BackReferenceTest.JsonPath  evaluation should succeed when first array element is present in second  path        Error Details           JsError(List((,List(JsonValidationError(List(Expecting a JsObject but got a different structure),List()))))) did not equal JsSuccess({"id":"1","code":"a"},) Stack Trace | 4 ms | 1
   org.apache.james.jmap.json.BackReferenceTest.JsonPath  evaluation should succeed when pointing to specific array elements and  specific path        Error Details           JsError(List((,List(JsonValidationError(List(Expecting a JsObject but got a different structure),List()))))) did not equal JsSuccess("1",) Stack Trace | 2 ms | 1
   ```
   
   This sounds related ;-)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina commented on pull request #765:
URL: https://github.com/apache/james-project/pull/765#issuecomment-981261978


    > I think the `list[0].id` syntax is wrong and should not work...
    
    Your mean is `list[0]/id` ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758017025



##########
File path: server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/json/BackReferenceTest.scala
##########
@@ -46,12 +46,15 @@ class BackReferenceTest extends AnyWordSpec with Matchers {
   }
 
   "Array element parsing" should {
-    "succeed when poositive" in {
+    "succeed when positive" in {
       ArrayElementPart.parse("[1]") should equal(Some(ArrayElementPart(1)))
     }
     "succeed when zero" in {
       ArrayElementPart.parse("[0]") should equal(Some(ArrayElementPart(0)))

Review comment:
       I just fixed the grammar




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina edited a comment on pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina edited a comment on pull request #765:
URL: https://github.com/apache/james-project/pull/765#issuecomment-981261978






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758099275



##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -75,27 +73,8 @@ object JsonPath {
       case "" => Nil
       case "*" => List(WildcardPart)
       case string if ArrayElementPart.parse(string).isDefined => ArrayElementPart.parse(string)
-      case part: String =>
-        val arrayElementPartPosition = part.indexOf('[')
-        if (arrayElementPartPosition < 0) {
-          asPlainPart(part)
-        } else if (arrayElementPartPosition == 0) {
-          asArrayElementPart(string)
-        } else {
-          asArrayElementInAnObject(string, part, arrayElementPartPosition)
-        }
+      case part: String => List(PlainPart(part))

Review comment:
       yes but we could only have one `case` for both and thus call `ArrayElementPart.parse(string)` only once




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #765:
URL: https://github.com/apache/james-project/pull/765#issuecomment-981265601


   > Note: When the part value is number Then part is ArrayElementPart
   
   What does RFC-6901 states about this?
   
   Do we care about this edge case? Do we have within our JMAP data model any object property name being a number?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758013853



##########
File path: server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/json/BackReferenceTest.scala
##########
@@ -46,12 +46,15 @@ class BackReferenceTest extends AnyWordSpec with Matchers {
   }
 
   "Array element parsing" should {
-    "succeed when poositive" in {
+    "succeed when positive" in {
       ArrayElementPart.parse("[1]") should equal(Some(ArrayElementPart(1)))
     }
     "succeed when zero" in {
       ArrayElementPart.parse("[0]") should equal(Some(ArrayElementPart(0)))

Review comment:
       This sould no longer happen, right?

##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -82,14 +84,14 @@ object JsonPath {
         } else if (arrayElementPartPosition == 0) {
           asArrayElementPart(string)
         } else {
-          asArrayElementInAnObject(string, part, arrayElementPartPosition)
+          asArrayElementInAnObject(part, arrayElementPartPosition)
         }
     })
 
   private def asPlainPart(part: String): List[JsonPathPart] = List(PlainPart(part))
 
-  private def asArrayElementInAnObject(string: String, part: String, arrayElementPartPosition: Int): List[JsonPathPart] =
-    ArrayElementPart.parse(string.substring(arrayElementPartPosition))
+  private def asArrayElementInAnObject(part: String, arrayElementPartPosition: Int): List[JsonPathPart] =
+    ArrayElementPart.parse(part.substring(arrayElementPartPosition))

Review comment:
       I think it is because with the previous syntax a JSON path path (what is between `/`) could be both a property with an array element accessor: 2 in 1. (eg `a/b[1]/c` have a `b[1]` part that is actually `property b` + `element 1`).
   
   The right JSON path syntax is simpler and have a 1 to 1 relationship: `a/b/1/c` : we can likely simplify `JsonPath.parse` a looot!

##########
File path: server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/json/BackReferenceTest.scala
##########
@@ -98,6 +98,29 @@ class BackReferenceTest extends AnyWordSpec with Matchers {
 
       jsonPath.evaluate(json) should equal(JsSuccess(expected))
     }
+    "succeed when first array element is present in second path" in {
+      val jsonPath = JsonPath.parse("path/0")
+      val json = Json.parse("""{"path":[{"id":"1","code":"a"},{"id":"2","code":"b"},{"id":"3","code":"c"}]}""".stripMargin)
+      val expected = Json.parse("""{"id":"1","code":"a"}""")
+
+      jsonPath.evaluate(json) should equal(JsSuccess(expected))
+    }
+    "succeed when pointing to specific array elements and specific path" in {
+      val jsonPath = JsonPath.parse("path/0/id")

Review comment:
       What happen if I go out of bound eg with `path/4/id`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on a change in pull request #765: JAMES-3677 BackReference should allow pointing to specific array elements

Posted by GitBox <gi...@apache.org>.
vttranlina commented on a change in pull request #765:
URL: https://github.com/apache/james-project/pull/765#discussion_r758012481



##########
File path: server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/ProcessingContext.scala
##########
@@ -82,14 +84,14 @@ object JsonPath {
         } else if (arrayElementPartPosition == 0) {
           asArrayElementPart(string)
         } else {
-          asArrayElementInAnObject(string, part, arrayElementPartPosition)
+          asArrayElementInAnObject(part, arrayElementPartPosition)
         }
     })
 
   private def asPlainPart(part: String): List[JsonPathPart] = List(PlainPart(part))
 
-  private def asArrayElementInAnObject(string: String, part: String, arrayElementPartPosition: Int): List[JsonPathPart] =
-    ArrayElementPart.parse(string.substring(arrayElementPartPosition))
+  private def asArrayElementInAnObject(part: String, arrayElementPartPosition: Int): List[JsonPathPart] =
+    ArrayElementPart.parse(part.substring(arrayElementPartPosition))

Review comment:
       This change coverage test case `"succeed when first array element is present and specific path"`
   ```scala
    "succeed when first array element is present and specific path" in {
         val jsonPath = JsonPath.parse("path[0]/id")
         val json = Json.parse("""{"path":[{"id":"1","code":"a"},{"id":"2","code":"b"},{"id":"3","code":"c"}]}""".stripMargin)
         val expected = JsString("1")
   
         jsonPath.evaluate(json) should equal(JsSuccess(expected))
       }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org