Releases: kkharji/clj-duct-reitit
🔖 release 0.3.1
🎉 0.3.1 - 2022-01-11
Exceptions
2a8c648 ✨ Feature: Auto-detect user exceptions handler
When user defined `project-ns.handler/exceptions` or `project.ns.handler.exceptions/main` it should auto-detected and set it
6535c96 ✨ Feature: Append pretty message to coercion by default.
When coercer is defined this should be appended by default. Although, support is needed for schema and malli errors.
Logging
a7f3d6b ✨ Feature: Support request logging
Example Output:Pretty Mode:
Starting Request ------------------------ Request Time: 10:53:27 Request Method: "GET" Request URI: "/divide" Request Params: {:body {:y 2, :x 2}} ----------------------------------------- Finishing Request ------------------------ Request Method: "GET" Request URI: "/divide" Request Duration: 0 ms ------------------------------------------
Compact Mode:
[:starting {:method GET, :uri /divide, :params {:body {:y 2, :x 2}}}] [:completed {:method GET, :uri /divide, :completed-in 0}]
- dda7378 ✨ Feature: Malli compact and pretty format
Middleware
- 80f65a7 ✨ Feature: Cross-origin support
Module
- 528820c 🐛 Fix: Implicit require of duct.reitit
🔖 release 0.3.0
🎉 0.3.0 - 2022-01-09
Full Changelog: 0.2.0...0.3.0
Dev
663a8de ✨ Feature: Pretty print exceptions
Wow I didn't except such an improvement
General
- 6a8e8af ♻️ Refactor: Duct module structure
Logging
4a693a1 ♻️ Refactor: Total rewrite
Unlike before where the user needs to specify a list of stuff to log, now each item need to be set to boolean individually. Not totally sure I'd keep this but at least tests are passing.
e6772ed ✨ Feature: Merge logging config into one submodule
Mostly refactoring to make all logging configuration handled in a single submodule.
BREAKING: Change in how coercion and exception logging is handled. Now to enable logging for exception or coercion, it should be passed in `#duct.reitit/logging{:types []}`
5bd4d6b 🌱 Enhancement: Skip logging with coercion errors
With in coercion handler there is logging. However, this feels wrong because logging shouldn't be done there.
Module
398ae33 ♻️ Refactor: Total rewrite and decoupling
- rename main router function key to `duct.reitit/router` instead of `duct.router/reitit`. - rename main handler function key to `duct.reitit/handler` instead of `duct.handler/root`. - create separate initializer for `duct.reitit/routes`. It seems to go along the lines of decoupling processing steps. - refactor `duct.module/reitit` and make more readable and easy to reason with. - move default config along with development and production profile mutations to `duct/reitit/defaults.clj`. - refactor reitit module initializer logic to somewhat general purpose module initializer.(module/init {:root :duct.reitit :config config :extra [(registry-tree registry)] :store {:namespaces namespaces :routes routes} :schema {::registry (registry-references registry) ::routes [:routes :namespaces ::registry] ::router [::routes ::options ::log] ::log ::options ::handler [::router ::options ::log]}})
This make create modules similar duct.reitit easier.
TODO: move to external library.- change tests to reflect new changes
- remove many redundant files.
Readme
- 6b2ce55 📚 Documentation: Update
Tests
- daa0a83 ♻️ Refactor: Clean up tests
🔖 release 0.2.0
🎉 0.2.0 - 2022-01-03
Exceptions
0c491bc ✨ Feature: Response customization based on class or `:type`
To further understand how this work. checkout https://cljdoc.org/d/metosin/reitit/0.5.15/doc/ring/exception-handling-with-ring#exceptioncreate-exception-middleware
9e9a021 ✨ Feature: Log exceptions + pretty print.
Example output with `pretty?`; (err) ERROR [duct.reitit.middleware.exception:52] - ; (err) ; (err) {:message "Divide by zero", ; (err) :uri "/divide", ; (err) :method :get, ; (err) :params {:body {:y 0, :x 0}}, ; (err) :trace ; (err) [{:file-name "Numbers.java", :line-number 188} ; (err) {:file-name "handler.clj", :line-number 17} ; (err) {:file-name "exception.clj", :line-number 49} ; (err) {:file-name "middleware.clj", :line-number 73} ; (err) {:file-name "middleware.clj", :line-number 12}]} ; (err)
f966f83 ✨ Feature: Optional duct/logger
if no logger provided in options, just use pretty print for logging
General
- 8331954 👷 Misc: Update outdated keys
Middleware
d8d1d2f ✨ Feature: Inject keys instead of injecting `environment`
This was originally the intended behavior. but it was ignored in last release.
Module
-
6f0cf24 ✅ Test: Detailed tests for configuration processing
-
fb9f033 ✨ Feature: Apply defaults + change schema
-
74eacfd 📚 Documentation: Update description and spec in readme.
Readme
- e69b1af 👷 Misc: Format configuration example
Notes
Breaking Changes + Code Restructuring
Full Changelog: 0.1.0...0.2.0
🔖 release 0.1.0
🎉 0.1.0 - 2022-01-02
General
b48a45b ♻️ Refactor: Move files and change configuration keys
BREAKING: rename `:duct.module.reitit/key` => `:duct.reitit/key`
- dbbb99e ✅ Test: General update
Handler
c610a77 ✨ Feature: Add ring-handler
Following module https://github.com/duct-framework/module.web.Everything will come done to duct.handler/root
Middleware
10f44a3 ♻️ Refactor: Create macro for defining middlewares
a macro to abstract the complexity of creating reitit middleware.
9e8a221 ♻️ Refactor: Move exception handling
Create a new file under reitit.middleware to process and create exception middleware.
-
d80f2b4 ✅ Test: Coercion
-
f46c883 ✅ Test: Parameters validation
-
f2406d0 ✨ Feature: Access environment key within handlers
-
eb7eaa0 ✨ Feature: Pretty print coercion errors.
Module
2bbc180 ♻️ Refactor: Change require configuration schema.
It's a bit weird how duct works, I don't like the fact that modules are outside the base profile. Here I took the same approach as existing duct modules and kept module initialization with empty map.
Router
🔖 release 0.0.1
🎉 0.0.1 - 2021-12-29
Module
-
87afe9f ♻️ Refactor: Cleanup & readability
-
3abcd06 ✅ Test: Read module configuration
-
829cbaa ✨ Feature: Process registry and merge to config
-
7c74c8b ✨ Feature: Use module.registry for passing functions
Readme
- df77cb0 📚 Documentation: Explain how duct.module/reitit should work
- 4f1a09a 📚 Documentation: Rename reitit/options -> reitit/opts
- 9cec7b8 📚 Documentation: Introduce malli as coercion option
Dev
- dbddfa9 ✨ Feature: Add clj-dev