Created by: mcac0006
PR checklist
-
Read the contribution guidelines. -
Ran the shell script under ./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. -
Filed the PR against the correct branch: master
,. Default:3.4.x
,4.0.x
master
. -
Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
Description of the PR
Problem: The current spring generator generates the API interfaces but does not allow the operation methods to throw unhandled, checked exceptions, thus forcing the implementation to handle the exceptions.
In certain situations, checked exceptions are desired to be left unhandled which are then interpreted as HTTP500 responses. Construct like Spring's @ControllerAdvice
would be a perfect fit to handle all unhandled exceptions and throw a standard HTTP500 response. Currently, this is not possible and all operations must write their own try { ... } catch (Exception e) { ... }
construct to take care of this, generating a lot of boilerplate code.
Solution: An additional flag, unhandledException
, would determine whether all operation methods would declare themselves whether they would allow throwing any kind of exception (throws Exception)
. Setting the flag false would avoid the throws
declaration and leave everything as-is.
Reviewers
@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger