swagger-api / swagger-api/swagger-codegen

@Pattern @NotNull validation not added to swagger specification from code

Open
#6,167 0 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

I have generated a Java Spring project using CodeGen from a pre-defined Swagger Specification. In the code I can see the @Pattern, @NotNull added to the correct fields. However if I manually add @Pattern to new fields and try to look at the swagger by going to .../api-docs URL, I don't see these being added to the field in swagger definitions.

Swagger-codegen version

Spring fox version 2.5.0

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

Reproduce the generated Java Spring project with Spring Fox 2.5.0 and inspect the /api-docs output for fields carrying manually added @Pattern and @NotNull annotations. Compare those definitions with the generated code and the original Swagger specification; done means the annotations are represented correctly in the generated API documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.