Skip to content

Fixed exception handler order #1320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bespaltovyj
Copy link
Contributor

Hi, I fixed a bug due to which the documentation incorrectly displayed information obtained from the ExceptionHandler.
The problem was when there were 2 exception handlers (controller - local and global).

The documentation displayed information from the global, but in the Spring, the priority is higher for the local.

The problem was in the method AbstractOpenApiResource#getOpenApi. It him combined information about the 'Exception Handler' from the ControllerAdvice and from the controller. But HashMap was used as a container for which the order is not guaranteed.

I changed the container type to LinkedHashMap.

An exampleof a simple application in which you can check the issue

@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Oct 23, 2021

@bespaltovyj,

Agree for the fix !
Your branch contains conflicting changes.
You should synchronize with master and resolve the conflicts before proposing the PR.

@bespaltovyj bespaltovyj force-pushed the bugfix/fix-exception-handler-order branch from abf3628 to d909674 Compare October 23, 2021 12:04
@bespaltovyj
Copy link
Contributor Author

@bnasslahsen fixed.
we just made changes at the same time

@bnasslahsen bnasslahsen merged commit ad45a94 into springdoc:master Oct 23, 2021
@bnasslahsen
Copy link
Collaborator

@bespaltovyj,

Perfect!
Thank you for your contribution to the project👍

@bnasslahsen bnasslahsen added the bug Something isn't working label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants