swagger-api / swagger-api/swagger-codegen

Regex pattern not generated for input type header

Open
#10,960 2 comments 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

Description

Im trying to generate the API from a swagger 2.0 yml file, and I want to have for headers a specific regex pattern.
Swagger-codegen version that I'm using is: 2.3.1

An example would be:
..... parameters: - name: Header that I want description: some description required: true in: header type: string pattern: ^[a-zA-Z0-9]{8}-?[a-zA-Z0-9]{4}-?[a-zA-Z0-9]{4}-?[a-zA-Z0-9]{4}-?[a-zA-Z0-9]{12}$ maxLength: 36

When generating the API, the regeq pattern annotation is not created, and therefore it's not apply this regex.

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 reproducing the issue with the supplied Swagger 2.0 YAML example using swagger-codegen 2.3.1. Check the generated header parameter handling and its treatment of the pattern field; done means the generated API applies the specified regular-expression constraint.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.