-
Notifications
You must be signed in to change notification settings - Fork 82
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
Docs within defrecord #145
Comments
This sounds like it may be a bug. Can you please paste a code snippet here showing your |
(defrecord Resource
[resource-name]
StandardOperations
(get-all [_]
;; a GET on the root of a resource (e.g. /api/v2/users.json)
((plural resource-name) (api-call :get (base-url resource-name))))
(get-one [_ id]
;; a GET on a specific resource (e.g. /api/v2//users/3.json)
((singular resource-name) (api-call :get (str (base-url resource-name) "/%s") [id])))
(create [_ data]
;; a POST on the root of a resource (e.g. /api/v2/users.json)
((singular resource-name) (api-call :post
(base-url resource-name)
nil
{(singular resource-name) data})))
(delete [_ id]
;; a DELETE on a specific resource (e.g. /api/v2//users/3.json)
(api-call :delete (str (base-url resource-name) "/%s") [id])))
I've tried the comment under As far as I can workout, |
I'm afraid that you're correct - Docstrings usually live in the protocol definition, e.g. (defprotocol StandardOperations
(get-all [self] "a GET on the root of a resource (e.g. /api/v2/users.json)")
;; etc
) I haven't done much Clojure lately, so am possibly forgetting something relevant; as far as I recall, this works in marginalia currently. |
Ah, thanks! I think what got me was the the docstring in defprotocol come On 16 January 2015 at 12:51, Ben Bader [email protected] wrote:
-- Alistair |
Hmm, seems like Marginalia still doesn't like it. (defprotocol StandardOperations
"Many resources have a standard range of things you can do with them (CRUD, basically)."
(get-all [_] "a GET on the root of a resource (e.g. /api/v2/users.json)")
(get-one [_ id])
(create [_ data])
(update [_ id data])
(delete [_ id])) |
OK, that's certainly a problem. I'll keep this issue open to track it. https://github.com/gdeer81/marginalia/blob/master/src/marginalia/parser.clj#L232 indicates that we at at least attempt to extract docstrings from protocol methods. I may be missing something, but it seems that we are not doing this properly. Thanks for the report. |
Hello! Is there a way to add docs for the method implementations in
defrecord
? Right now I just have a big block of comments before thedefrecord
expression, which is nowhere near as nice as having the docs for each method implementation side-by-side in the Marginalia output.Any ideas?
The text was updated successfully, but these errors were encountered: