swagger-api / swagger-api/swagger-codegen
[Java] need apply toRegularExpression method for pattern from string model
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Otherwise, for the generated model for Spring, the annotation contains an incorrect regexp.
example: @Pattern(regexp="^\d{4}$")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java at line 3184 and inspect how the pattern string is handled for generated Spring models. Check the generated @Pattern annotation using the provided regexp example, and consider the work complete when the annotation contains the correctly transformed regular expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100