Skip to content

[BUG][JAVA] Prevent generating "pattern" and "size" to ENUM - #18658

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
jorgerod:bugfix/GH-18477-prevent-constraints-enum-c
May 13, 2024
Merged

wing328 merged 1 commit into
OpenAPITools:masterfrom
jorgerod:bugfix/GH-18477-prevent-constraints-enum-c

Conversation

@jorgerod

@jorgerod jorgerod commented May 13, 2024 •

Copy link
Copy Markdown
Contributor

Closes: #18477

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh ./bin/configs/*.yaml
    ./bin/utils/export_docs_generators.sh
    
    (For Windows users, please run the script in Git BASH)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.1.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08)

cc/ @wing328

@wing328
wing328 merged commit 4a872a8 into OpenAPITools:master May 13, 2024
@wing328 wing328 added this to the 7.6.0 milestone May 20, 2024
@tom999

tom999 commented Aug 5, 2024 •

Copy link
Copy Markdown

Seems issue still exists in 7.7.0? Because I still get the same issue with

  • generator "spring"
  • library "spring-cloud"
  • options
    • useJakartaEe: true
    • useSpringBoot3: true

        clearingType:
          type: string
          maxLength: 10
          description: |
            Clearing type must be one of the following value
            <ul>
              <li> PHONENUM (Phone Number) </li>
              <li> UUID (Universally Unique Identifier) </li>
              <li> SUB (Contract) </li>
              <li> BP (Bill Profile) </li>
            </ul>
          enum:
            - PHONENUM
            - UUID
            - SUB
            - BP
          example: PHONENUM

generates:

  /**
   * Clearing type must be one of the following value <ul>   <li> PHONENUM (Phone Number) </li>   <li> UUID (Universally Unique Identifier) </li>   <li> SUB (Contract) </li>   <li> BP (Bill Profile) </li> </ul> 
   * @return clearingType
   */
  @NotNull @Size(max = 10)
  @Schema(name = "clearingType", example = "PHONENUM", description = "Clearing type must be one of the following value <ul>   <li> PHONENUM (Phone Number) </li>   <li> UUID (Universally Unique Identifier) </li>   <li> SUB (Contract) </li>   <li> BP (Bill Profile) </li> </ul> ", requiredMode = Schema.RequiredMode.REQUIRED)
  @JsonProperty("clearingType")
  public ClearingTypeEnum getClearingType() {
    return clearingType;
  }

  public void setClearingType(ClearingTypeEnum clearingType) {
    this.clearingType = clearingType;
  }

and @SiZe(max=10) generates error:
HV000030: No validator could be found for constraint 'jakarta.validation.constraints.Size'

@hqrd

hqrd commented Oct 4, 2024 •

Copy link
Copy Markdown

Doesn't it break the enum validation, is this is an array ? @wing328

        closing_days:
          type: array
          minItems: 1
          items:
            type: string
            enum: [ MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY ]

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 this pull request may close these issues.

[BUG][JAVA] Prevent generating "pattern" and "size" to ENUM

4 participants