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
  • #6182
Closed
Open
Issue created May 05, 2020 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][Java][Spring] Unhandled exception ignored

Created by: RaduFurnea

Bug Report Checklist

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

The option to add unhandledException is ignored when skipDefaultInterface is set to true. This behaviour is obvious by inspecting line 132 of the api.mustache.

openapi-generator version

4.3.0

Steps to reproduce
  1. Generate Spring server code from any specification with unhandledException=true. Observe how the default interface methods have 'throws Exception' declared.
  2. Generate Spring server code from any specification with unhandledException=true and skipDefaultInterface=true. Observe how the interface methods don't have 'throws Exception' declared.
Related issues/PRs

The PR that added the option. https://github.com/OpenAPITools/openapi-generator/pull/2482

Suggest a fix

I suggest moving the parameter outside of the skipDefaultInterface block so that the 2 options are independent. @jimschubert mentioned on Slack that this could affect people that unknowingly have unhandledException set to true, and skipDefaultInterface set to true also, which is correct to some extent, but having an exception thrown in the interface does not force the implementation to throw it too, so the change is definitely backwards compatible.

Assignee
Assign to
Time tracking