]> 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)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 20 Mar 2025 18:18:29 +0000 (18:18 +0000)
commite0657bbfa2dda257dc4d4f89e3e1351b2c8336b5
tree496b583ac95ba4777e068601a798f7da612edcaa
parent4132254345b138a77a107497911b3be34db77923
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.

(cherry picked from commit cc267af3e1e11d4fb06b3f1080b5cdaae47f7b89)
rest-api-templates/swagger_model.py