Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@NotNull not generated when 'required' is declared in inheriting model #7058

Closed
gintautassulskus opened this issue Nov 25, 2017 · 3 comments · Fixed by #10549
Closed

@NotNull not generated when 'required' is declared in inheriting model #7058

gintautassulskus opened this issue Nov 25, 2017 · 3 comments · Fixed by #10549
Assignees
Milestone

Comments

@gintautassulskus
Copy link

gintautassulskus commented Nov 25, 2017

Description

Swagger-codegen does not generate the @NotNull annotation for the required property password of model UserRegister. The email property declared in model User is handled correctly, I can see the @NotNull annotation if front the corresponding method.

This has something to do with inheritance. The required field in the inheriting model (in this case - UserRegister) is ignored for both inherited (email) and new (password) properties.

Swagger-codegen version

2.2.3

Swagger declaration file content or url
definitions:
  User:
      type: object     
      required:
        - email
      properties:
        email:
          type: string
  UserRegister:
      allOf:  
        - $ref: '#/definitions/User'
      type: object
      required:
        - password
      properties:
        password:
          type: string
Maven configuration
          <plugin>
               <groupId>io.swagger</groupId>
               <artifactId>swagger-codegen-maven-plugin</artifactId>
               <version>2.2.3</version>
               <executions>
                   <execution>
                       <goals>
                           <goal>generate</goal>
                       </goals>
                       <id>willbot</id>
                       <configuration>
                           <inputSpec>demo.yaml</inputSpec>
                           <language>spring</language>
                           <configOptions>
                               <sourceFolder>src/gen/main/java</sourceFolder>
                               <useBeanValidation>true</useBeanValidation>
                               <enable303>true</enable303>
                           </configOptions>
                           <apiPackage>server</apiPackage>
                           <modelNameSuffix>Dto</modelNameSuffix>
                       </configuration>
                   </execution>
               </executions>
           </plugin>
@holzerch
Copy link

I ran into the same problem. Is there any workaround?

@s1lent1um
Copy link

Still a problem wen using with jHipster

@mustafashabib
Copy link

Still a problem 3 years later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants