swagger-api / swagger-api/swagger-codegen

[Python][raw string]bad pattern with raw string

Open
#9,398 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

[Python][raw string]bad pattern with raw string

Description

raw string is not correctly used

Swagger-codegen version

2.4.4 it is a regression

Swagger declaration file content or url
Command line used for generation
Steps to reproduce

previous version:
re.search('^[\w\s:.,_-]*$', "UNITEST")
answer:<_sre.SRE_Match object at 0x132DE800>

this version:
re.search(r'^[\w\s:.,_-]*$', "UNITEST")
no match
because raw string is used but too more \

Related issues/PRs
Suggest a fix/enhancement

the good way is :
re.search(r'^[\w\s:.,_-]*$', "UNITEST")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Python code-generation template or entry point that emits the regex shown in the reproduction, then compare its output with the previous and desired patterns. Done means generated Python uses the intended raw-string escaping and the UNITEST search matches; add or run a regression check if the project provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.