From 6d229370f83d984a1d31b2fcd3e00fcb721a7b8e Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sat, 12 Feb 2022 14:03:06 -0600 Subject: tweaking doc generation --- example/lazybones-test-docs.md | 16 +++++----------- lazybones-documentation.lisp | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/example/lazybones-test-docs.md b/example/lazybones-test-docs.md index ab153a0..281b98c 100644 --- a/example/lazybones-test-docs.md +++ b/example/lazybones-test-docs.md @@ -9,8 +9,6 @@ Just an API that defines some endpoints. These ### POST /crapshoot *text/plain* - - Authorization Required: > Randomly decides that the request is authorized @@ -22,11 +20,6 @@ Echos back 'You made it' if the request was authorized ### POST /hello/:who: *text/plain* -Route Variables: - -- WHO - - Authorization Required: > Request is authorized if it contains the right TESTAPPSESSION @@ -34,6 +27,11 @@ Authorization Required: +Route Variables: + +- WHO + + Echo's back 'Hello WHO, I got your message BODY' where BODY is the post body. ### GET /hello/:who: @@ -49,8 +47,6 @@ Echos back Hello WHO ### POST /login *text/plain* - - Dummy login endpoint for returning a session cookie. Always returns the "true" and sends a set-cookie header, setting 'testappsession' to 'coolsessionbro'. @@ -79,8 +75,6 @@ Echo back a random number between lo and hi ### GET /search *text/plain* - - Documented Query Parameters: - name: A String diff --git a/lazybones-documentation.lisp b/lazybones-documentation.lisp index 5aedaba..30ba6b6 100644 --- a/lazybones-documentation.lisp +++ b/lazybones-documentation.lisp @@ -30,8 +30,17 @@ (princ "*") (princ (if content-type content-type default-content-type )) (princ "*") - newline + (when authorizer + newline + (princ "Authorization Required: ") + newline + (cond ((function-or-function-name-p authorizer) + (princ (ensure-blockquote (documentation authorizer 'function)))) + ((function-or-function-name-p default-authorizer) + (princ (ensure-blockquote (documentation default-authorizer 'function))))) + newline) (a:when-let (vars (endpoint-route-vars ep)) + newline (princ "Route Variables: ") newline (dolist (var vars) (princ "- ") (princ var) @@ -45,16 +54,6 @@ do (princ "- ") (princ (string-downcase (symbol-name var))) (princ ": ") (princ (strip-newlines (documentation parser 'function))) (princ #\newline))) - - (when authorizer - newline - (princ "Authorization Required: ") - newline - (cond ((function-or-function-name-p authorizer) - (princ (ensure-blockquote (documentation authorizer 'function)))) - ((function-or-function-name-p default-authorizer) - (princ (ensure-blockquote (documentation default-authorizer 'function))))) - newline) newline (princ endpoint-documentation) )))))) -- cgit v1.2.3