Skip to content
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

Order the apps to run by class name to provide more predictable ordering #1593

Merged
merged 2 commits into from
Mar 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.helidon.microprofile.openapi;

import java.lang.reflect.InvocationTargetException;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -92,8 +93,12 @@ private List<FilteredIndexView> buildPerAppFilteredIndexViews() {
* which case we'll try to instantiate them ourselves (unless they are synthetic apps or lack no-args constructors).
*
* Each set in the list holds the classes related to one app.
*
* Sort the stream by the Application class name to help keep the list of endpoints in the OpenAPI document in a stable
* order.
*/
List<Set<Class<?>>> appClassesToScan = appInstancesToRun().stream()
.sorted(Comparator.comparing(app -> app.getClass().getName()))
.map(this::classesToScanForApp)
.collect(Collectors.toList());

Expand Down