gregspurrier / checked-route Goto Github PK
View Code? Open in Web Editor NEWType-checked Compojure Routes
License: MIT License
Type-checked Compojure Routes
License: MIT License
I'm either doing something wrong, or perhaps checked-routes don't support routes that look like:
(GET "/performance-overview" { ^{:check (partial val/validation-errors schema)} params :params}
(do :something))
This is the code from my application. The GET++ just handles some common duplication in the code.
(defmacro ^:private GET++ [route environment schema handler]
`(cr/checked GET ~route { ^{:check (partial val/validation-errors ~schema)} params# :params}
(~handler ~environment params#)))
(GET++ "/performance-overview" env performance-overview-params-schema web-pages/performance-overview)
When I hit the route, localhost/performance-overview?foo=1, where this route expects no params whatsoever, it seems like the validation errors were evaluated correctly, but something crazy happens inside ring... Notice the errors showing in the stacktrace (#{"Path [:foo] was not specified in the schema."})
Here's my stacktrace:
2012-11-01 10:45:33.614:WARN:oejs.AbstractHttpConnection:/performance-overview?foo=1
java.lang.Exception: Unrecognized body: {:errors {params__31__auto__ #{"Path [:foo] was not specified in the schema."}}}
at ring.util.servlet$set_body.invoke(servlet.clj:103)
at ring.util.servlet$update_servlet_response.invoke(servlet.clj:112)
at ring.adapter.jetty$proxy_handler$fn__3581.invoke(jetty.clj:21)
at ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle(Unknown Source)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:191)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:680)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.