private def removeNode()

in http-core/src/main/scala/com/twitter/finatra/http/jsonpatch/JsonPatchOperator.scala [241:253]


  private def removeNode(path: JsonPointer, target: JsonNode): Unit = {
    if (path.tail == null) {
      throw new JsonPatchException("invalid path for remove operation")
    } else if (path.tail.matches) {
      target match {
        case on: ObjectNode => on.remove(path.getMatchingProperty)
        case an: ArrayNode => an.remove(getLeafIndex(path, an, "remove"))
        case _ => throw new JsonPatchException("invalid target for remove")
      }
    } else {
      removeNode(path.tail, nextNodeByPath(path, target, "remove"))
    }
  }