From 77b9de313365e050934ad2e0026af0a56c21a40b Mon Sep 17 00:00:00 2001 From: David Denton Date: Tue, 23 Jan 2024 22:19:24 +0000 Subject: [PATCH] add kosthi adapter to container credentials moshi --- CHANGELOG.md | 3 +++ .../containercredentials/ContainerCredentialsMoshi.kt | 7 +++++++ amazon/core/src/main/kotlin/org/http4k/format/CoreMoshi.kt | 1 + 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 791498b75..00156540c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ This list is not intended to be all-encompassing - it will document major and breaking API changes with their rationale when appropriate. Given version `A.B.C.D`, breaking changes are to be expected in version number increments where changes in the `A` or `B` sections: +### v5.6.8.2 +- **http4k-connect-amazon-containercredentials*** - Add Kotshi adapter to Moshi instance. + ### v5.6.8.1 - **http4k-connect-*** - Fix AutoMarshalledPageAction not recognising arrays with whitespace. diff --git a/amazon/containercredentials/client/src/main/kotlin/org/http4k/connect/amazon/containercredentials/ContainerCredentialsMoshi.kt b/amazon/containercredentials/client/src/main/kotlin/org/http4k/connect/amazon/containercredentials/ContainerCredentialsMoshi.kt index 3bd6811a2..9f8ad9947 100644 --- a/amazon/containercredentials/client/src/main/kotlin/org/http4k/connect/amazon/containercredentials/ContainerCredentialsMoshi.kt +++ b/amazon/containercredentials/client/src/main/kotlin/org/http4k/connect/amazon/containercredentials/ContainerCredentialsMoshi.kt @@ -1,17 +1,24 @@ package org.http4k.connect.amazon.containercredentials +import com.squareup.moshi.JsonAdapter import com.squareup.moshi.Moshi import org.http4k.format.AwsCoreJsonAdapterFactory import org.http4k.format.ConfigurableMoshi import org.http4k.format.asConfigurable import org.http4k.format.withAwsCoreMappings import org.http4k.format.withStandardMappings +import se.ansman.kotshi.KotshiJsonAdapterFactory object ContainerCredentialsMoshi : ConfigurableMoshi( Moshi.Builder() .add(AwsCoreJsonAdapterFactory()) + .add(ContainerCredentialsAdapterFactory) .asConfigurable() .withStandardMappings() .withAwsCoreMappings() .done() ) + + +@KotshiJsonAdapterFactory +internal object ContainerCredentialsAdapterFactory : JsonAdapter.Factory by KotshiContainerCredentialsAdapterFactory diff --git a/amazon/core/src/main/kotlin/org/http4k/format/CoreMoshi.kt b/amazon/core/src/main/kotlin/org/http4k/format/CoreMoshi.kt index 9f69d1412..78385153c 100644 --- a/amazon/core/src/main/kotlin/org/http4k/format/CoreMoshi.kt +++ b/amazon/core/src/main/kotlin/org/http4k/format/CoreMoshi.kt @@ -5,6 +5,7 @@ import com.squareup.moshi.Moshi object AwsCoreMoshi : ConfigurableMoshi( Moshi.Builder() .add(AwsCoreJsonAdapterFactory()) + .add(CoreAdapterFactory) .add(ListAdapter) .add(MapAdapter) .asConfigurable()