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

generate source code from ring.util.http-response functions #3

Closed
ikitommi opened this issue Aug 10, 2014 · 2 comments
Closed

generate source code from ring.util.http-response functions #3

ikitommi opened this issue Aug 10, 2014 · 2 comments

Comments

@ikitommi
Copy link
Member

Separate spray-code-extracting to user-namespace, build source code to 'ring.util.http-response` from there

  • better ide-support (autocomplete & refactor)
  • faster (don't have to expand macros in client projects)
  • spray2clojure code will be in this codebase, can be rerun easily
@ikitommi
Copy link
Member Author

ikitommi commented Feb 5, 2015

idea continued:

  • separate EDN-file containing the http-statuses
  • access to the EDN-data at runtime
  • generate also a separate namespace with http-response-codes by name:
(ns ring.util.http-response-codes)

(def ok 200)
...
(def not-found 404)

... would help in writing documentation per status code:

(require '[ring.util.http-response :as h])
(require '[ring.util.http-response-codes :as hc])
{:responses {hc/ok {:schema Pet}
            {hc/forbidden {:schema ForbiddenForest}}}

...

(def handler [request]
   ...
   (if valid? (h/ok a-pet) (h/forbidden a-forbidden-forest))

@ikitommi
Copy link
Member Author

ikitommi commented Feb 5, 2015

relates to #2

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

No branches or pull requests

1 participant