Skip to content

Commit a79ab47

Browse files
committed
Release 0.41.4
Remove static singleton Moshi instance Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 5d5cf67 commit a79ab47

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endif::[]
1818
:pmtemplates: src/integrationTest/resources/pm-templates
1919
:imagesdir: docs/images
2020
:prewrap!:
21-
:revoman-version: 0.41.3
21+
:revoman-version: 0.41.4
2222

2323
'''
2424

buildSrc/src/main/kotlin/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* ************************************************************************************************
77
*/
88
const val GROUP_ID = "com.salesforce.revoman"
9-
const val VERSION = "0.41.3"
9+
const val VERSION = "0.41.4"
1010
const val ARTIFACT_ID = "revoman"
1111
const val STAGING_PROFILE_ID = "1ea0a23e61ba7d"

src/main/kotlin/com/salesforce/revoman/internal/json/MoshiReVoman.kt

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,6 @@ import org.http4k.format.asConfigurable
3333
import org.http4k.format.withStandardMappings
3434

3535
internal lateinit var moshiReVoman: Moshi
36-
private val moshiBuilder: Moshi.Builder =
37-
Moshi.Builder()
38-
.add(JsonString.Factory())
39-
.add(AdaptedBy.Factory())
40-
.add(TypeAdapter)
41-
.add(BigDecimalAdapter)
42-
.add(UUIDAdapter)
43-
.add(EpochAdapter)
44-
.add(Date::class.java, Rfc3339DateJsonAdapter())
45-
.addLast(CaseInsensitiveEnumAdapter.FACTORY)
46-
.addLast(EventAdapter)
47-
.addLast(ThrowableAdapter)
48-
.addLast(ListAdapter)
49-
.addLast(MapAdapter)
50-
.asConfigurable()
51-
.withStandardMappings()
52-
.done()
5336

5437
@JvmOverloads
5538
internal fun initMoshi(
@@ -68,6 +51,25 @@ internal fun buildMoshi(
6851
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
6952
typesToIgnore: Set<Class<out Any>> = emptySet()
7053
): Moshi.Builder {
54+
// * NOTE 08 May 2024 gopala.akshintala: This cannot be static singleton as adapters added mutates
55+
// the singleton
56+
val moshiBuilder =
57+
Moshi.Builder()
58+
.add(JsonString.Factory())
59+
.add(AdaptedBy.Factory())
60+
.add(TypeAdapter)
61+
.add(BigDecimalAdapter)
62+
.add(UUIDAdapter)
63+
.add(EpochAdapter)
64+
.add(Date::class.java, Rfc3339DateJsonAdapter())
65+
.addLast(CaseInsensitiveEnumAdapter.FACTORY)
66+
.addLast(EventAdapter)
67+
.addLast(ThrowableAdapter)
68+
.addLast(ListAdapter)
69+
.addLast(MapAdapter)
70+
.asConfigurable()
71+
.withStandardMappings()
72+
.done()
7173
customAdaptersWithType.forEach { (type, customAdapters) ->
7274
customAdapters.forEach { customAdapter ->
7375
customAdapter.fold({ moshiBuilder.add(type, it) }, { moshiBuilder.add(it) })

0 commit comments

Comments
 (0)