Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • Merge requests
  • !7150

[Java][jaxrs] Add getter to ApiException templates

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/Xendar/bugifx/6830 into master 4 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 13

Created by: Xendar

Fixes #6830 (closed)

Basically a few ApiException templates for Java servers were missing a getter for the code field.
Before the fix the generated class was:

package org.openapitools.api;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen", date = "2020-07-01T16:12:55.083+02:00[Europe/Paris]")
public class ApiException extends Exception{
    private int code;
    public ApiException (int code, String msg) {
        super(msg);
        this.code = code;
    }
}

With the fix it becomes:

package org.openapitools.api;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen", date = "2020-08-06T22:46:58.073+02:00[Europe/Paris]")
public class ApiException extends Exception {

    private int code;

    public ApiException(int code, String msg) {
        super(msg);
        this.code = code;
    }

    public int getCode() {
        return code;
    }

}

Validation

I compiled the cli jar and generated the new class with the same command as in the issue description, then compiled the generated code.

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.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. 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*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

Technical committee: @bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @bkabrda

Checking approval status

Merged by (Jul 27, 2025 8:17pm UTC)

Loading

Activity


  • Administrator changed title from Bug #3830: Java server - Add getter to ApiException templates to Issue #6830: Java server - Add getter to ApiException templates 4 years ago

    changed title from Bug #3830: Java server - Add getter to ApiException templates to Issue #6830: Java server - Add getter to ApiException templates

  • Administrator mentioned in issue #6830 (closed) 4 years ago

    mentioned in issue #6830 (closed)

  • Administrator closed 4 years ago

    closed

  • Administrator reopened 4 years ago

    reopened

  • Administrator requested review from @wing328 4 years ago

    requested review from @wing328

  • William Cheng added Enhancement: General Server: Java labels 4 years ago

    added Enhancement: General Server: Java labels

  • William Cheng changed milestone to %5.0.0 4 years ago

    changed milestone to %5.0.0

  • William Cheng changed title from {-Issue #6830 (closed): -}Java server - Add getter to ApiException templates to Java server - Add getter to ApiException templates 4 years ago

    changed title from {-Issue #6830 (closed): -}Java server - Add getter to ApiException templates to Java server - Add getter to ApiException templates

  • William Cheng changed title from Java server - Add getter to ApiException templates to [Java][jaxrs] Add getter to ApiException templates 4 years ago

    changed title from Java server - Add getter to ApiException templates to [Java][jaxrs] Add getter to ApiException templates

  • William Cheng closed 4 years ago

    closed

Please register or sign in to reply
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
2
Enhancement: General Server: Java
2
Enhancement: General Server: Java
    Assign labels
  • Manage project labels

Milestone
5.0.0
5.0.0 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
participants
Reference: OpenAPITools/openapi-generator!7150
Source branch: github/fork/Xendar/bugifx/6830

Menu

Explore Projects Groups Snippets