swagger-api / swagger-api/swagger-codegen

[Java] swagger-codegen-maven-plugin 2.3.1 not generate @valid annotations

Open
#8,200 3 comments 3 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 using java/ swagger-codegen-maven-plugin 2.3.1 with the follwoing settings. I see my swagger constraints being generated, but dont see @valid tag being added per https://github.com/swagger-api/swagger-codegen/issues/5498

<execution> <goals> <goal>generate</goal> </goals> <id>serviceability-generate-sources</id> <phase>generate-sources</phase> <configuration> <output>${project.build.directory}</output> <inputSpec>src/main/resources/swagger/api.yaml</inputSpec> <language>jaxrs-cxf</language> <configHelp></configHelp> <configOptions> <sourceFolder>generated</sourceFolder> <dateLibrary>java8</dateLibrary> <apiPackage>com.test.api</apiPackage> <modelPackage>com.test.api.model</modelPackage> <useBeanValidation>true</useBeanValidation> <performBeanValidation>true</performBeanValidation> </configOptions> </configuration> </execution>

Question: How do I trigger generation of @valid code per issues/5498

Swagger-codegen version

io.swagger
swagger-codegen-maven-plugin
2.31

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

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 with the swagger-codegen-maven-plugin 2.3.1 execution shown in the issue, using src/main/resources/swagger/api.yaml and the jaxrs-cxf language with useBeanValidation and performBeanValidation enabled. Compare the generated sources with the behavior described in issue 5498; done means the generated Java code includes the expected @Valid annotations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
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.