mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2025-02-17 06:37:29 +00:00
Add TranscodingInfoTranscodeReasonsHook to fix issue with OpenAPI spec
This commit is contained in:
parent
6f96e5b7d3
commit
68ad896e42
@ -9,12 +9,14 @@ import org.jellyfin.openapi.hooks.model.DotNetDescriptionHook
|
||||
import org.jellyfin.openapi.hooks.model.ImageMapsHook
|
||||
import org.jellyfin.openapi.hooks.model.SwashbuckleDescriptionHook
|
||||
import org.jellyfin.openapi.hooks.model.SyncPlayGroupUpdateHook
|
||||
import org.jellyfin.openapi.hooks.model.TranscodingInfoTranscodeReasonsHook
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
|
||||
val hooksModule = module {
|
||||
single { ImageMapsHook() } bind TypeBuilderHook::class
|
||||
single { SyncPlayGroupUpdateHook() } bind TypeBuilderHook::class
|
||||
single { TranscodingInfoTranscodeReasonsHook() } bind TypeBuilderHook::class
|
||||
|
||||
single { BinaryOperationUrlHook() } bind OperationUrlHook::class
|
||||
single { ClientLogOperationUrlHook() } bind OperationUrlHook::class
|
||||
|
@ -0,0 +1,24 @@
|
||||
package org.jellyfin.openapi.hooks.model
|
||||
|
||||
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.plusParameter
|
||||
import io.swagger.v3.oas.models.media.Schema
|
||||
import org.jellyfin.openapi.builder.openapi.OpenApiTypeBuilder
|
||||
import org.jellyfin.openapi.constants.Types
|
||||
import org.jellyfin.openapi.hooks.ModelTypePath
|
||||
import org.jellyfin.openapi.hooks.TypeBuilderHook
|
||||
import org.jellyfin.openapi.hooks.TypePath
|
||||
|
||||
/**
|
||||
* A hook that modifies the type of the "transcodeReasons" property in "TranscodingInfo" to fix an issue with the
|
||||
* OpenAPI specification. It replaces the "String" type with "Collection<String>". When the bug is fixed it should
|
||||
* use "Collection<TranscodeReason>".
|
||||
*
|
||||
* Reference: https://github.com/jellyfin/jellyfin-sdk-kotlin/issues/510
|
||||
*/
|
||||
class TranscodingInfoTranscodeReasonsHook : TypeBuilderHook {
|
||||
override fun onBuildType(path: TypePath, schema: Schema<*>, typeBuilder: OpenApiTypeBuilder) = when (path) {
|
||||
ModelTypePath("TranscodingInfo", "transcodeReasons") ->
|
||||
Types.COLLECTION.plusParameter(Types.STRING)
|
||||
else -> null
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user