Closed wandersoncferreira closed 4 years ago
2.0.0-alpha30
I tried to include a middleware to deal with bigdecimals data type in my payload by using:
(context "/contracts" [] :middleware [wrap-json-body {:bigdecimals? true}] (resource {:tags ["assignments"] :coercion :spec :post {:summary "inform contract offers" :parameters {:body-params ::contracts/spec} :handler (fn [{contracts :body-params}] (let [opid (core/launch-processing contracts/process-offers contracts :contract)] (ok {:operation-id opid})))}}))
However, I get this stack trace:
java.lang.NullPointerException: null repl_1 | at ring.middleware.json$wrap_json_body$fn__17449.invoke(json.clj:62) ~[na:na] repl_1 | at compojure.api.compojure_compat$make_context$handler__26700.invoke(compojure_compat.clj:28) ~[classes/:na] repl_1 | at compojure.api.compojure_compat$make_context$fn__26702.invoke(compojure_compat.clj:37) ~[classes/:na] repl_1 | at compojure.api.routes.Route.invoke(routes.clj:91) [classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034.invoke(core.clj:198) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034$respond_SINGLEQUOTE___19035.invoke(core.clj:197) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034.invoke(core.clj:199) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034$respond_SINGLEQUOTE___19035.invoke(core.clj:197) ~[classes/:na] repl_1 | at compojure.core$wrap_route_matches$fn__19014.invoke(core.clj:153) ~[classes/:na] repl_1 | at compojure.api.routes.Route.invoke(routes.clj:91) [classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034.invoke(core.clj:198) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034$respond_SINGLEQUOTE___19035.invoke(core.clj:197) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034.invoke(core.clj:199) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034$respond_SINGLEQUOTE___19035.invoke(core.clj:197) ~[classes/:na] repl_1 | at ring.middleware.head$wrap_head$fn__18815$fn__18816.invoke(head.clj:36) ~[classes/:na] repl_1 | at ring.middleware.not_modified$wrap_not_modified$fn__27122$fn__27123.invoke(not_modified.clj:64) ~[classes/:na] repl_1 | at ring.middleware.content_type$wrap_content_type$fn__27097$fn__27098.invoke(content_type.clj:37) ~[classes/:na] repl_1 | at ring.swagger.swagger_ui$serve$fn__27142.invoke(swagger_ui.clj:43) ~[classes/:na] repl_1 | at ring.middleware.content_type$wrap_content_type$fn__27097.invoke(content_type.clj:36) ~[classes/:na] repl_1 | at ring.middleware.not_modified$wrap_not_modified$fn__27122.invoke(not_modified.clj:63) ~[classes/:na] repl_1 | at ring.middleware.head$wrap_head$fn__18815.invoke(head.clj:35) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034.invoke(core.clj:198) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033.invoke(core.clj:200) ~[classes/:na] repl_1 | at compojure.api.routes.Route.invoke(routes.clj:91) [classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034.invoke(core.clj:198) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033.invoke(core.clj:200) ~[classes/:na] repl_1 | at compojure.api.routes.Route.invoke(routes.clj:91) [classes/:na] repl_1 | at compojure.core$routes$fn__19033$f__19034.invoke(core.clj:198) ~[classes/:na] repl_1 | at compojure.core$routes$fn__19033.invoke(core.clj:200) ~[classes/:na] repl_1 | at compojure.api.routes.Route.invoke(routes.clj:91) [classes/:na] repl_1 | at ring.swagger.middleware$wrap_swagger_data$fn__27044.invoke(middleware.clj:37) ~[classes/:na] repl_1 | at compojure.api.middleware$wrap_swagger_data$fn__25466.invoke(middleware.clj:192) ~[classes/:na] repl_1 | at compojure.api.middleware$wrap_inject_data$fn__25444.invoke(middleware.clj:98) [classes/:na] repl_1 | at muuntaja.middleware$wrap_params$fn__24565.invoke(middleware.clj:54) ~[classes/:na] repl_1 | at compojure.api.middleware$wrap_exceptions$fn__25433.invoke(middleware.clj:67) [classes/:na] repl_1 | at muuntaja.middleware$wrap_format_request$fn__24577.invoke(middleware.clj:116) [classes/:na] repl_1 | at compojure.api.middleware$wrap_exceptions$fn__25433.invoke(middleware.clj:67) [classes/:na] repl_1 | at muuntaja.middleware$wrap_format_response$fn__24581.invoke(middleware.clj:134) [classes/:na] repl_1 | at muuntaja.middleware$wrap_format_negotiate$fn__24574.invoke(middleware.clj:98) [classes/:na] repl_1 | at ring.middleware.keyword_params$wrap_keyword_params$fn__23607.invoke(keyword_params.clj:55) [classes/:na] repl_1 | at ring.middleware.nested_params$wrap_nested_params$fn__23657.invoke(nested_params.clj:91) [classes/:na] repl_1 | at ring.middleware.params$wrap_params$fn__23705.invoke(params.clj:69) [classes/:na] repl_1 | at compojure.api.middleware$wrap_inject_data$fn__25444.invoke(middleware.clj:98) [classes/:na] repl_1 | at compojure.api.routes.Route.invoke(routes.clj:91) [classes/:na] repl_1 | at clojure.lang.Var.invoke(Var.java:393) [clojure-1.10.0.jar:na] repl_1 | at ring.adapter.jetty$async_proxy_handler$fn__37773.invoke(jetty.clj:35) [classes/:na] repl_1 | at ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle(Unknown Source) [classes/:na] repl_1 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] repl_1 | at org.eclipse.jetty.server.Server.handle(Server.java:503) [jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] repl_1 | at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) [jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] repl_1 | at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) [jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] repl_1 | at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) [jetty-io-9.4.12.v20180830.jar:9.4.12.v20180830] repl_1 | at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [jetty-io-9.4.12.v20180830.jar:9.4.12.v20180830] repl_1 | at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) [jetty-io-9.4.12.v20180830.jar:9.4.12.v20180830] repl_1 | at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) [jetty-util-9.4.15.v20190215.jar:9.4.15.v20190215] repl_1 | at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) [jetty-util-9.4.15.v20190215.jar:9.4.15.v20190215] repl_1 | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_232]
I am approaching this problem correctly?
Library Version(s)
2.0.0-alpha30
Problem
I tried to include a middleware to deal with bigdecimals data type in my payload by using:
However, I get this stack trace:
I am approaching this problem correctly?