Remove DisplayPreferencesDtoNullabilityFixHook

This commit is contained in:
Niels van Velzen 2022-04-17 11:43:05 +02:00 committed by Max Rumpf
parent d37b0e2bcf
commit 2a9dd0f1ba
2 changed files with 0 additions and 22 deletions

View File

@ -3,7 +3,6 @@ package org.jellyfin.openapi.hooks
import org.jellyfin.openapi.hooks.api.BinaryOperationUrlHook
import org.jellyfin.openapi.hooks.api.PlayStateServiceNameHook
import org.jellyfin.openapi.hooks.model.DefaultUserIdHook
import org.jellyfin.openapi.hooks.model.DisplayPreferencesDtoNullabilityFixHook
import org.jellyfin.openapi.hooks.model.ImageMapsHook
import org.jellyfin.openapi.hooks.model.SyncPlayGroupUpdateHook
import org.koin.dsl.bind
@ -12,7 +11,6 @@ import org.koin.dsl.module
val hooksModule = module {
single { ImageMapsHook() } bind TypeBuilderHook::class
single { SyncPlayGroupUpdateHook() } bind TypeBuilderHook::class
single { DisplayPreferencesDtoNullabilityFixHook() } bind TypeBuilderHook::class
single { BinaryOperationUrlHook() } bind OperationUrlHook::class

View File

@ -1,20 +0,0 @@
package org.jellyfin.openapi.hooks.model
import com.squareup.kotlinpoet.typeNameOf
import io.swagger.v3.oas.models.media.Schema
import org.jellyfin.openapi.builder.openapi.OpenApiTypeBuilder
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 "customPrefs" property in "DisplayPreferencesDto" to fix a nullability issue.
* In the 10.7 API specification the value of the map is incorrectly labelled as not-null.
* This hook changes the type to the exact type emitted from the 10.8 alpha API specification.
*/
class DisplayPreferencesDtoNullabilityFixHook : TypeBuilderHook {
override fun onBuildType(path: TypePath, schema: Schema<*>, typeBuilder: OpenApiTypeBuilder) = when (path) {
ModelTypePath("DisplayPreferencesDto", "customPrefs") -> typeNameOf<Map<String, String?>>()
else -> null
}
}