Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions code-gen.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(200 (cl-json:decode-json body)))))

;;; RE Pattern
(defparameter *parameter-pattern* "{([a-zA-Z\-]+)}")
(defparameter *parameter-pattern* "{([a-zA-Z\-_\.]+)}")

(defun parse-path-parameters (path)
"returns two values, 1st is non param path element, 2nd are the params.
Expand Down Expand Up @@ -69,7 +69,9 @@
"
;;
;; summary : {{summary}}
;; description : {{{description}}}
{{#description}}
;; {{{.}}}
{{/description}}
;; * path : {{paths}}
;;
(defun {{first-name}}-{{path-name}} (&key param content basic-authorization)
Expand Down Expand Up @@ -99,7 +101,9 @@
(define rest-call-templete-v1
"
;;
;; {{description}}
{{#description}}
;; {{{.}}}
{{/description}}
;; * path-url : {{paths}}
;;
(defun {{first-name}}-{{path-name}} (&key params content basic-authorization)
Expand All @@ -112,7 +116,9 @@
(define rest-call-templete-v2
"
;;
;; {{description}}
{{#description}}
;; {{{.}}}
{{/description}}
;; * path-url : {{paths}}
;;
(defun {{first-name}}-{{path-name}} (path-url &key params content basic-authorization)
Expand Down Expand Up @@ -168,7 +174,7 @@
(:path-url . ,(first paths))
(:first-name . ,(lambda () (string-downcase (format nil "~A" (first path)))))
(:method . ,(lambda() (format nil ":~A" (first path))))
(:description . ,(lambda() (format nil "~A" (cl-ppcre:regex-replace-all "\\n" (get-in '(:|description|) (cdr path)) "\\n"))))
(:description . ,(cl-ppcre:split "\\n" (or (get-in '(:|description|) (cdr path)) "")))
(:accept . ,"application/json")
(:accept-type . "application/json"))))
(if options
Expand Down