branch: elpa/gptel
commit 66c7dc9fdd191e372e93a8eb8b359117b1d607b5
Author: Karthik Chikmagalur <karthikchikmaga...@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmaga...@gmail.com>

    gptel: Fix regex for spaces in one-line schema parsing
    
    * gptel.el (gptel--dispatch-schema-type): When parsing a
    single-line schema format, ignore whitespace at the end of the
    line.  Before this fix, a shorthand schema (with . indicating
    whitespace) like
    
      holiday_date.str., description, observed_from_year.int..
    
    was trying to match 'str.' and 'int..' against the list of types
    instead of 'str' and 'int'.
---
 gptel.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gptel.el b/gptel.el
index d44317ef716..94b56f98d50 100644
--- a/gptel.el
+++ b/gptel.el
@@ -1667,7 +1667,7 @@ SCHEMA can be specified in several ways:
                  (all-types '("number" "string" "integer" "boolean" "null")))
             (if (= (point-max) (line-end-position)) ; Single or multi-line?
                 ;; Single line format (type optional): "key1 type, key2, ..."
-                (while (re-search-forward ",?\\([^ ,]+\\) *\\([^,]*\\]?\\)" 
nil t)
+                (while (re-search-forward ",?\\([^ ,]+\\) *\\([^ ,]*\\]?\\)" 
nil t)
                   (push (match-string 1) props)
                   (push (if (string-empty-p (match-string 2))
                             "string" (car (all-completions (match-string 2) 
all-types)))

Reply via email to