From 77c1069200b8140e65ccb6bd6baeb71754499e17 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Wed, 12 Feb 2025 11:43:44 +0800 Subject: [PATCH] build: cleanup openapi reference generation --- komga/build.gradle.kts | 1 - ...rConfiguration.kt => OpenApiConfiguration.kt} | 16 +++++++++++----- komga/src/main/resources/application.yml | 9 ++------- 3 files changed, 13 insertions(+), 13 deletions(-) rename komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/{SwaggerConfiguration.kt => OpenApiConfiguration.kt} (72%) diff --git a/komga/build.gradle.kts b/komga/build.gradle.kts index c4ac82784..3a1f768b5 100644 --- a/komga/build.gradle.kts +++ b/komga/build.gradle.kts @@ -1,4 +1,3 @@ - import nu.studer.gradle.jooq.JooqGenerate import org.apache.tools.ant.taskdefs.condition.Os import org.flywaydb.gradle.task.FlywayMigrateTask diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/SwaggerConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/OpenApiConfiguration.kt similarity index 72% rename from komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/SwaggerConfiguration.kt rename to komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/OpenApiConfiguration.kt index 10239683b..0b1269fd3 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/SwaggerConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/OpenApiConfiguration.kt @@ -10,7 +10,7 @@ import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @Configuration -class SwaggerConfiguration { +class OpenApiConfiguration { @Bean fun openApi(): OpenAPI = OpenAPI() @@ -20,9 +20,7 @@ class SwaggerConfiguration { .version("v1.0") .description( """ - Komga offers 2 APIs: REST and OPDS. - - Both APIs are secured using HTTP Basic Authentication. + Komga RESTful API. """.trimIndent(), ).license(License().name("MIT").url("https://github.com/gotson/komga/blob/master/LICENSE")), ).externalDocs( @@ -33,7 +31,15 @@ class SwaggerConfiguration { Components() .addSecuritySchemes( "basicAuth", - SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("basic"), + SecurityScheme() + .type(SecurityScheme.Type.HTTP) + .scheme("basic"), + ).addSecuritySchemes( + "apiKey", + SecurityScheme() + .type(SecurityScheme.Type.APIKEY) + .`in`(SecurityScheme.In.HEADER) + .name("X-API-Key"), ), ) } diff --git a/komga/src/main/resources/application.yml b/komga/src/main/resources/application.yml index 9846a9f40..e7c508215 100644 --- a/komga/src/main/resources/application.yml +++ b/komga/src/main/resources/application.yml @@ -93,14 +93,9 @@ management: enabled: true step: 24h springdoc: - group-configs: - - group: REST API - paths-to-match: /api/** - - group: OPDS v1 - paths-to-match: /opds/v1.2/** - - group: OPDS v2 - paths-to-match: /opds/v2/** swagger-ui: groups-order: desc operations-sorter: alpha disable-swagger-default-url: true + tags-sorter: alpha + paths-to-match: "/api/**"