]> git.ipfire.org Git - thirdparty/asterisk.git/commit
swagger_model.py: Fix invalid escape sequence in get_list_parameter_type().
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 4 Mar 2025 14:29:22 +0000 (07:29 -0700)
committerGeorge Joseph <gjoseph@sangoma.com>
Wed, 5 Mar 2025 21:42:54 +0000 (21:42 +0000)
commit5e187e528bb589dd328f51ad30e89bcb7025f3e8
tree4bf199a876ed5ee537effd3f3b4740aa55de5173
parent2b09d5bb311db561954ae9cfe62421bc1231368b
swagger_model.py: Fix invalid escape sequence in get_list_parameter_type().

Recent python versions complain when backslashes in strings create invalid
escape sequences.  This causes issues for strings used as regex patterns like
`'^List\[(.*)\]$'` where you want the regex parser to treat `[` and `]`
as literals.  Double-backslashing is one way to fix it but simply converting
the string to a raw string `re.match(r'^List\[(.*)\]$', text)` is easier
and less error prone.
rest-api-templates/swagger_model.py