From 35ebbc14ace990aa74885b733b28a974bd4a546e Mon Sep 17 00:00:00 2001 From: adrianstanciu Date: Tue, 27 May 2025 12:35:51 +0200 Subject: [PATCH 1/4] Fix OpenAPI module ordering to respect settings.gradle.kts include() order - Modified copySubProjectsOpenAPIFiles task to sort modules based on the order defined in settings.gradle.kts - Replaced alphabetical ordering with custom sorting that uses rootProject.subprojects order - Unknown modules are placed at the end using Int.MAX_VALUE as sort key - This ensures the generated OpenAPI specification preserves the intended module sequence --- api/build.gradle.kts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 10d371c07..d850a87a1 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -46,6 +46,9 @@ tasks.register("copySubProjectsOpenAPIFiles") { // By convention, we expect OpenAPI files for sub-projects to be named and placed as follows: // /src/main/openapi/.yaml // For example: organization/src/main/openapi/organization.yaml + // Get the order from settings.gradle.kts include() declaration + val moduleOrder = rootProject.subprojects.map { it.name } + val sourcePaths = configurations.implementation .get() @@ -60,6 +63,12 @@ tasks.register("copySubProjectsOpenAPIFiles") { .map { file("${it}/src/main/openapi/${it.relativeTo(rootDir)}.yaml") } .filter { it.exists() } .map { it.absolutePath } + .sortedBy { path -> + // Extract module name from path and find its index in the desired order + val moduleName = file(path).parentFile.parentFile.parentFile.name + val index = moduleOrder.indexOf(moduleName) + if (index >= 0) index else Int.MAX_VALUE // Put unknown modules at the end + } .toMutableList() // If you need to reference a non-conventional path, feel free to add it below to the // sourcePaths local variable, like so: sourcePaths.add("my/path/to/another/openapi.yaml") From 3fc3886b2c79d66e5980a605151bdb23914adddf Mon Sep 17 00:00:00 2001 From: adrianstanciu Date: Tue, 27 May 2025 14:08:29 +0200 Subject: [PATCH 2/4] reordered sections in api, to follow logical order and improve clarity for users --- settings.gradle.kts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index c3db77d46..e2f0c93ba 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,7 +15,15 @@ pluginManagement { rootProject.name = "cosmotech-api-parent" include( - "api", "meta", "dataset", "organization", "solution", "workspace", "metrics", "runner", "run") + "api", + "organization", + "solution", + "workspace", + "dataset", + "runner", + "run", + "meta", + "metrics") project(":api").name = "cosmotech-api" From 7cb94499dedcb3f351129b877dbe2a29f6f8182c Mon Sep 17 00:00:00 2001 From: adrianstanciu Date: Wed, 28 May 2025 11:01:19 +0200 Subject: [PATCH 3/4] fix formatting (blank line) --- api/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index d850a87a1..94834d8b6 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -48,7 +48,7 @@ tasks.register("copySubProjectsOpenAPIFiles") { // For example: organization/src/main/openapi/organization.yaml // Get the order from settings.gradle.kts include() declaration val moduleOrder = rootProject.subprojects.map { it.name } - + val sourcePaths = configurations.implementation .get() From b9baef2864c3526a8654c6a97cd256a6ffc05fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Reynard?= Date: Fri, 27 Jun 2025 09:58:58 +0200 Subject: [PATCH 4/4] Format `settings.gradle.kts` by combining `include` arguments into a single line --- settings.gradle.kts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index e2f0c93ba..c11804768 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,15 +15,7 @@ pluginManagement { rootProject.name = "cosmotech-api-parent" include( - "api", - "organization", - "solution", - "workspace", - "dataset", - "runner", - "run", - "meta", - "metrics") + "api", "organization", "solution", "workspace", "dataset", "runner", "run", "meta", "metrics") project(":api").name = "cosmotech-api"