]> 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:53 +0000 (21:42 +0000)
commitc30ffc08a7bfc2bb494c2c6cb94c9b5577c815eb
treee59ee378f3e6f68ec070fed931894ca66cbcd6a0
parent44ca269adbcfc328f65ba9073374e1cec011440f
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