diff options
author | colin <colin@cicadas.surf> | 2024-05-12 12:30:41 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2024-05-12 12:30:41 -0700 |
commit | 442d5e0616b8158eae5428b022254bdcb0cdaa62 (patch) | |
tree | fe15abf5ff05fc5ef6f364804ec0d97b09d4e7fb | |
parent | 5cce96a68272bab5204b806116be98bee051a97d (diff) |
Add: defendpoint parameters signal slot-required when necessary
-rw-r--r-- | src/defendpoint.lisp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/defendpoint.lisp b/src/defendpoint.lisp index 0ac9ec9..dd39368 100644 --- a/src/defendpoint.lisp +++ b/src/defendpoint.lisp @@ -42,11 +42,12 @@ PART is either (symbolp (first spec)) (symbolp (second spec)))) -(defun params-to-slotdefs (specs) +(defun params-to-slotdefs (endpoint specs) (loop :for (name type . doc) :in specs :collect `(,name :accessor ,name :initarg ,(a:make-keyword name) + :initform (slot-required ',endpoint ',name) :type ,type :documentation ,(or (first doc) "")))) @@ -75,7 +76,7 @@ PART is either (setf var (or var (gensym "REQ-"))) (setf metaclass (or metaclass 'endpoint)) (let* ((slot-defs - (nconc (params-to-slotdefs parameters) + (nconc (params-to-slotdefs name parameters) (props-to-slotdefs properties))) (all-slots (nconc (mapcar #'first slot-defs) @@ -130,9 +131,6 @@ PART is either (:@ supers (:? <supers>)) (:@ method <method>) (:@ pathspec <pathspec>) - ; (:@ return (:? <return>)) -; (:@ params (:? <parameters>)) -; (:@ props (:? <properties>)) (:@ options (:* <option>)) (:@ handle <handle>) (:eof)) @@ -141,10 +139,7 @@ PART is either method pathspec handle -; return :supers supers -; :parameters params -; :properties props (a:alist-plist options))) (<supers> :match (:seq (:or= :using :extends) (:+ <classname>)) @@ -163,14 +158,16 @@ PART is either :note "REGEX or (KWD REGEX &optional PARSER)") (<parameters> :match (:seq (:= :parameters) (:+ <param>)) - :then (cons :parameters (second <parameters>))) + :then (cons :parameters (second <parameters>)) + :note "Request parameters - will signal an error if missing from the user request") (<param> :match (:item) :if parameter-spec-p :note "(NAME TYPE &optional DOCSTRING)") (<properties> :match (:seq (:= :properties) (:+ <prop>)) - :then (cons :properties (second <properties>))) + :then (cons :properties (second <properties>)) + :note "Values that should be filled-in during authentication or authorization") (<prop> :match (:item) :if property-spec-p |