jlesquembre / clj-nix

Nix helpers for Clojure projects
https://jlesquembre.github.io/clj-nix/
Eclipse Public License 2.0
139 stars 20 forks source link

Allow a JsonNode to be passed for vars #40

Closed charles-dyfis-net closed 1 year ago

charles-dyfis-net commented 1 year ago

In trying to implement a service with clj-jq that receives requests in JSON form and sends responses in JSON form, it makes sense to deserialize as little as possible.

However, trying to pass a JsonNode (corresponding with {"n": 100} to an expression that uses a variable $n) for vars presently results in the following:

java.lang.UnsupportedOperationException: nth not supported on this type: IntNode
 at clojure.lang.RT.nthFrom (RT.java:992)
    clojure.lang.RT.nth (RT.java:940)
    jq.api.api_impl$new_scope.invokeStatic (api_impl.clj:154)
    jq.api.api_impl$new_scope.invoke (api_impl.clj:144)
    jq.api$stream_processor.invokeStatic (api.clj:83)
    jq.api$stream_processor.invoke (api.clj:75)
charles-dyfis-net commented 1 year ago

Argh, filed this on the wrong project