Default Duckula handler. It talks JSON but can validate requests with provided Avro schemas
Default Duckula handler. It talks JSON but can validate requests with provided Avro schemas
(build config)
Sort of a router, but does validation. Config has to have the form of: { "/some/route" {:handler ring.rquest.handler/function :response "path/to/avro/response/Schema" :request "path/to/avro/request/Schema"} ; .. and more "/no/validation" {:handler ring.req.handler/no-validation} } Handler assumes that requests use application/json for input and output as content types. For 100% avro input/input we'd need a slightly different builder (and ring middlewares). It depends on a component implementing duckula.prococol/Monitoring protocol
Sort of a router, but does validation. Config has to have the form of: { "/some/route" {:handler ring.rquest.handler/function :response "path/to/avro/response/Schema" :request "path/to/avro/request/Schema"} ; .. and more "/no/validation" {:handler ring.req.handler/no-validation} } Handler assumes that requests use application/json for input and output as content types. For 100% avro input/input we'd need a slightly different builder (and ring middlewares). It depends on a component implementing duckula.prococol/Monitoring protocol - request count (success, error, failure) - request timing - track exceptions
(build-metric-keys {:keys [endpoints prefix] :as config})
For each endpoint it constructs a list of metric keys to be used when tracking timing, rates and errors Example for name test-api and /some/endpoint it will create test-api.some.endpoint test-api.some.endpoint.success test-api.some.endpoint.error test-api.some.endpoint.failure
For each endpoint it constructs a list of metric keys to be used when tracking timing, rates and errors Example for name test-api and /some/endpoint it will create test-api.some.endpoint test-api.some.endpoint.success test-api.some.endpoint.error test-api.some.endpoint.failure
(build-route-map {:keys [prefix endpoints] :as config})
Turns static config (documented below) into a map of function maps:
Turns static config (documented below) into a map of function maps: - request handler - request input validator - request output validator Validators use Avro to ensure passed in data is ok
(validate-with-tag tag validator-fn input monitoring)
Runs validation function and re-throws the exception with extra info attached. Each generated avro validator function carries metadata with schema name
Runs validation function and re-throws the exception with extra info attached. Each generated avro validator function carries metadata with schema name
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close