]> 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:51 +0000 (21:42 +0000)
commitcc267af3e1e11d4fb06b3f1080b5cdaae47f7b89
treef68d6e565ba7b5f5b40199542950be6769db6e21
parent5565d00eb41fa30c53bef883dbdfca74cf93bd1f
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