From 18d67e16348f3401a694a5a8d46af79610fadf49 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 16 Feb 2022 16:59:59 -0600 Subject: added definitions to apps; appended definitions to generated docs --- lazybones.lisp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lazybones.lisp') 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))) + -- cgit v1.2.3