From 971e5fb834758280e29bce54b3df1c24f32645fc Mon Sep 17 00:00:00 2001 From: egao1980 Date: Sat, 12 Jan 2019 17:21:47 +0000 Subject: [PATCH 1/2] Generating readable multiline descriptions --- code-gen.lisp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/code-gen.lisp b/code-gen.lisp index 8e79cfc..af39641 100644 --- a/code-gen.lisp +++ b/code-gen.lisp @@ -69,7 +69,9 @@ " ;; ;; summary : {{summary}} -;; description : {{{description}}} +{{#description}} +;; {{{.}}} +{{/description}} ;; * path : {{paths}} ;; (defun {{first-name}}-{{path-name}} (&key param content basic-authorization) @@ -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) @@ -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) @@ -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 From 924da9eed0df6b2ab2f13466cabb79d4b43709cc Mon Sep 17 00:00:00 2001 From: egao1980 Date: Sat, 12 Jan 2019 17:31:37 +0000 Subject: [PATCH 2/2] Fix parameter name pattern --- code-gen.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code-gen.lisp b/code-gen.lisp index af39641..5be7a44 100644 --- a/code-gen.lisp +++ b/code-gen.lisp @@ -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.