Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Being explicit & switching off infering keys for handlers/middlewares #5

Open
RickMoynihan opened this issue Mar 22, 2018 · 3 comments

Comments

@RickMoynihan
Copy link

I wonder if it might be possible to add an option e.g. :fully-qualified-keys true to turn key inference off in the ataraxy router config.

The reason I'd like this is when refactoring things you want to do a find/replace on the keys throughout the project, but because the keys in the router config are aliased, they get missed. Recently I was helping a new developer get up to speed and they'd done this, but this key got missed, and I found myself having to explain this, as an extra unintuitive convention, in addition to clojure's :: prefix and aliases via :as, as things to watch out for.

@weavejester
Copy link
Contributor

I've been considering a redesign of this module, but I'm not entirely sure how.

It's worth mentioning that you can just use the router on its own. It's a little more verbose, but it does have the advantage of no key inference.

@RickMoynihan
Copy link
Author

RickMoynihan commented May 1, 2018

Just to say I've run into another limitation because of this. You can't use this module with handlers and integrant composite keys.

e.g.

 :duct.module/ataraxy {
                       "/foo" {["" #{blah}] [[:composite-handler/foo :foo/bar]
                                             blah]}
}

@weavejester
Copy link
Contributor

You can add a unique key to your composite key, and use that instead:

{:duct.core/project-ns example
 :duct.module/ataraxy {["/foo" #{blah}] [:foo blah]}
 [:composite-handler/foo :foo/bar :example.handler/foo] {}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants