Skip to content

Commit 3cc0e0b

Browse files
author
Mathias Düsterhöft
committed
Improve operation sorting
1 parent d2371c8 commit 3cc0e0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

restdocs-openapi-gradle-plugin/src/main/kotlin/com/epages/restdocs/openapi/gradle/OpenApi20Generator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ internal object OpenApi20Generator {
130130
private fun groupByPath(resources: List<ResourceModel>): Map<String, List<ResourceModel>> {
131131
return resources.sortedWith(
132132
// by first path segment, then path length, then path
133-
comparing<ResourceModel, String> { it.request.path.split("/").firstOrNull().orEmpty() }
133+
comparing<ResourceModel, String> { it.request.path.split("/").firstOrNull { s -> s.isNotEmpty() }.orEmpty() }
134134
.thenComparing(comparingInt<ResourceModel> { it.request.path.count { c -> c == '/' } })
135135
.thenComparing(comparing<ResourceModel, String> { it.request.path }))
136136
.groupBy { it.request.path }

0 commit comments

Comments
 (0)