]> 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:34:08 +0000 (18:34 +0000)
commit77c6bf844f20c1ac43d1f98c00f92fe8cee3adc0
tree8fe90720d5bcd513a47fce0ec956f4b2d322409f
parent99ef285fffdf34ee9ae1b2ac929c270c8e3ff3d1
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 c30ffc08a7bfc2bb494c2c6cb94c9b5577c815eb)
rest-api-templates/swagger_model.py