Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5658
Closed
Open
Issue created Mar 21, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][jaxrs-reasteasy-eap] Generated Bean Validation annotations for Longs are invalid

Created by: dommaes

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • What's the version of OpenAPI Generator used?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • Bounty to sponsor the fix
Description

jaxrs-resteasy-eap generates invalid Bean Validation annotations for properties of the following type:

type: integer
format: int64
maximum: 9999999999

which are represented as Longs in generated Java code.

The generated Bean Validation annotation is @Max(9999999999) and the project doesn't compile, because 9999999999 is greater than Integer.MAX_VALUE. The generated annotation should be @Max(9999999999L).

openapi-generator version

4.2.3, 4.3.0-SNAPSHOT

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  version: 1.0.0
  title: OpenAPI Petstore
paths:
  /pet/{petId}:
    get:
      operationId: getPetById
      parameters:
        - name: petId
          in: path
          required: true
          schema:
            type: integer
            format: int64
            maximum: 9999999999
      responses:
        200:
          description: success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
Command line used for generation

java -jar openapi-generator-cli.jar generate -g jaxrs-resteasy-eap -i sample.yaml -o sample

Steps to reproduce
  1. run command
  2. try to build the project with Maven
Related issues/PRs

No

Suggest a fix

Use files

  • beanValidation.mustache
  • beanValidationCore.mustache
  • beanValidationHeaderParams.mustache
  • beanValidationPathParams.mustache
  • beanValidationQueryParams.mustache

from jaxrs-resteasy

I will open a PR with the suggested fix

Assignee
Assign to
Time tracking