diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defendpoint.lisp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/defendpoint.lisp b/src/defendpoint.lisp index 2e87874..872c336 100644 --- a/src/defendpoint.lisp +++ b/src/defendpoint.lisp @@ -1,3 +1,5 @@ +(in-package :weekend) + ;;; DEFENDPOINT (defun path-part-p (part) @@ -68,6 +70,7 @@ PART is either documentation authenticate authorize) + (loop :for super :in supers :do (mop:ensure-finalized (find-class super))) (setf var (or var (gensym "REQ-"))) (setf metaclass (or metaclass 'endpoint)) (let* ((slot-defs @@ -93,11 +96,12 @@ PART is either (list (list :metaclass metaclass)) (list (cons :method method)) (list (list* :route-parts route-parts)) - (list (cons :content-type return)) + (when return + (list (cons :content-type return))) (when extractors (list (list* :extractors extractors))) (when documentation - (list (list :documentation documentation)))))) + (list (cons :documentation documentation)))))) `(progn (defclass ,name ,supers ,slot-defs @@ -121,11 +125,11 @@ PART is either (argot:deflanguage defendpoint () (<class> - :match (:seq (:@ name (:item)) + :match (:seq (:@ name <classname>) (:@ supers (:? <supers>)) (:@ method <method>) (:@ pathspec <pathspec>) - (:@ return <return>) + (:@ return (:? <return>)) (:@ params (:? <parameters>)) (:@ props (:? <properties>)) (:@ options (:* <option>)) @@ -140,17 +144,17 @@ PART is either :supers supers :parameters params :properties props - options)) + (a:alist-plist options))) (<supers> - :match (:seq (:= :extends) (:+ <classname>)) + :match (:seq (:or= :using :extends) (:+ <classname>)) :then second) (<classname> :match (:item) - :if find-class) + :if (and (symbolp <classname>) (not (keywordp <classname>)))) (<method> :match (:or= :get :post :put :patch :head :delete)) (<pathspec> - :match (:seq (:or= :to :from :at) (:+ <pathpart>)) + :match (:seq (:or= :to :from :at :route) (:+ <pathpart>)) :then second) (<pathpart> :match (:item) @@ -191,7 +195,7 @@ PART is either (<var> :match (:seq (:= :var) (:item)) :if (symbolp (second <var>)) - :then (list :var (second <var>)) + :then (cons :var (second <var>)) :note "SYMBOL bound to the instance during the handler protocol.") (<authenticate> :match (:seq (:= :authenticate) (:item)) |