aboutsummaryrefslogtreecommitdiff
path: root/lazybones.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lazybones.lisp')
-rw-r--r--lazybones.lisp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lazybones.lisp b/lazybones.lisp
index fe2ebc3..c7be8d8 100644
--- a/lazybones.lisp
+++ b/lazybones.lisp
@@ -57,6 +57,13 @@
:initarg :vsn :initarg :version
:initform "0.0.1"
:type string)
+ (definitions
+ :accessor app-definitions
+ :initform (make-hash-table :test 'equal)
+ :documentation "Definitions are used in the generation of
+ documentation. They can be linked to from docstrings of
+ endpoints. Used to provide additional documentation for, e.g.,
+ JSON object specifications for post bodies or return types.")
(authorizer
:accessor request-authorizer
:initarg :auth
@@ -379,3 +386,13 @@ making a new one if not."
(signal 'http-error :content content :code code))
+;;; MANAGING DEFINITIONS
+
+(defun set-definition (name item-id definition-text &optional (app (lazybones:app)))
+ "Name is a string"
+ (setf (gethash name (app-definitions app)) (cons item-id definition-text)))
+
+(defun drop-definition (name &optional (app (lazybones:app)))
+ "Remove definition keyed by LINK-TARGET from APP."
+ (remhash name (app-definitions app)))
+