Skip to content

Commit

Permalink
Update all dependencies (#123)
Browse files Browse the repository at this point in the history
* Update all dependencies

| datasource     | package                                                                                                                 | from         | to           |
| -------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------ | ------------ |
| gradle-version | gradle                                                                                                                  | 8.11.1       | 8.12         |
| maven          | org.jetbrains.kotlinx:kotlinx-coroutines-test                                                                           | 1.9.0        | 1.10.1       |
| maven          | org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin | 0.16.3       | 0.17.0       |
| maven          | org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin                                                         | 2.0.21       | 2.1.0        |
| maven          | io.arrow-kt.arrow-gradle-config-versioning:io.arrow-kt.arrow-gradle-config-versioning.gradle.plugin                     | 0.12.0-rc.24 | 0.12.0-rc.26 |
| maven          | io.arrow-kt.arrow-gradle-config-publish:io.arrow-kt.arrow-gradle-config-publish.gradle.plugin                           | 0.12.0-rc.24 | 0.12.0-rc.26 |
| maven          | io.arrow-kt.arrow-gradle-config-nexus:io.arrow-kt.arrow-gradle-config-nexus.gradle.plugin                               | 0.12.0-rc.24 | 0.12.0-rc.26 |
| maven          | io.arrow-kt.arrow-gradle-config-kotlin:io.arrow-kt.arrow-gradle-config-kotlin.gradle.plugin                             | 0.12.0-rc.24 | 0.12.0-rc.26 |
| maven          | io.arrow-kt.arrow-gradle-config-formatter:io.arrow-kt.arrow-gradle-config-formatter.gradle.plugin                       | 0.12.0-rc.24 | 0.12.0-rc.26 |

* Spotless

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Alejandro Serrano <[email protected]>
  • Loading branch information
renovate[bot] and serras authored Jan 21, 2025
1 parent 5577f46 commit 6b7ac11
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import com.fasterxml.jackson.databind.ObjectMapper

public fun ObjectMapper.registerArrowModule(
eitherModuleConfig: EitherModuleConfig = EitherModuleConfig("left", "right"),
iorModuleConfig: IorModuleConfig = IorModuleConfig("left", "right")
iorModuleConfig: IorModuleConfig = IorModuleConfig("left", "right"),
): ObjectMapper =
registerModules(
// no longer required, as they are value classes
// NonEmptyListModule,
// NonEmptySetModule,
OptionModule,
EitherModule(eitherModuleConfig.leftFieldName, eitherModuleConfig.rightFieldName),
IorModule(iorModuleConfig.leftFieldName, iorModuleConfig.rightFieldName)
IorModule(iorModuleConfig.leftFieldName, iorModuleConfig.rightFieldName),
)

public data class EitherModuleConfig(val leftFieldName: String, val rightFieldName: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public class EitherSerializerResolver(leftFieldName: String, rightFieldName: Str
Either::class.java,
listOf(
UnionTypeSerializer.ProjectField(leftFieldName) { either -> either.swap().orNone() },
UnionTypeSerializer.ProjectField(rightFieldName) { either -> either.orNone() }
UnionTypeSerializer.ProjectField(rightFieldName) { either -> either.orNone() },
),
)

override fun findSerializer(
config: SerializationConfig,
javaType: JavaType,
beanDesc: BeanDescription?
beanDesc: BeanDescription?,
): JsonSerializer<*>? =
when {
Either::class.java.isAssignableFrom(javaType.rawClass) -> serializer
Expand All @@ -54,12 +54,12 @@ private fun <E, A> Either<E, A>.orNone(): Option<A> = fold({ None }, ::Some)

public class EitherDeserializerResolver(
private val leftFieldName: String,
private val rightFieldName: String
private val rightFieldName: String,
) : Deserializers.Base() {
override fun findBeanDeserializer(
type: JavaType,
config: DeserializationConfig,
beanDesc: BeanDescription?
beanDesc: BeanDescription?,
): JsonDeserializer<*>? =
when {
Either::class.java.isAssignableFrom(type.rawClass) ->
Expand All @@ -68,8 +68,8 @@ public class EitherDeserializerResolver(
type,
listOf(
UnionTypeDeserializer.InjectField(leftFieldName) { leftValue -> leftValue.left() },
UnionTypeDeserializer.InjectField(rightFieldName) { rightValue -> rightValue.right() }
)
UnionTypeDeserializer.InjectField(rightFieldName) { rightValue -> rightValue.right() },
),
)
else -> null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public class IorSerializerResolver(leftFieldName: String, rightFieldName: String
ProductTypeSerializer.ProjectField(rightFieldName) { ior ->
ior.fold({ none() }, { it.some() }, { _, r -> r.some() })
},
)
),
)

override fun findSerializer(
config: SerializationConfig,
type: JavaType,
beanDesc: BeanDescription?
beanDesc: BeanDescription?,
): JsonSerializer<*>? =
when {
Ior::class.java.isAssignableFrom(type.rawClass) -> serializer
Expand All @@ -56,13 +56,13 @@ public class IorSerializerResolver(leftFieldName: String, rightFieldName: String

public class IorDeserializerResolver(
private val leftFieldName: String,
private val rightFieldName: String
private val rightFieldName: String,
) : Deserializers.Base() {

override fun findBeanDeserializer(
javaType: JavaType,
config: DeserializationConfig,
beanDesc: BeanDescription?
beanDesc: BeanDescription?,
): JsonDeserializer<*>? =
when {
Ior::class.java.isAssignableFrom(javaType.rawClass) ->
Expand All @@ -76,7 +76,7 @@ public class IorDeserializerResolver(
ProductTypeDeserializer.InjectField(rightFieldName) { secondValue ->
secondValue.rightIor()
},
)
),
) { iors ->
// this reduce is safe because an Ior will always have either a left or a right
iors.reduce { first, second ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public object OptionSerializerResolver : Serializers.Base() {
type: ReferenceType,
beanDesc: BeanDescription?,
contentTypeSerializer: TypeSerializer?,
contentValueSerializer: JsonSerializer<Any>?
contentValueSerializer: JsonSerializer<Any>?,
): JsonSerializer<*>? =
if (Option::class.java.isAssignableFrom(type.rawClass)) {
val staticTyping =
Expand All @@ -63,7 +63,7 @@ public object OptionTypeModifier : TypeModifier() {
type: JavaType,
jdkType: Type,
context: TypeBindings?,
typeFactory: TypeFactory?
typeFactory: TypeFactory?,
): JavaType =
when {
type.isReferenceType || type.isContainerType -> type
Expand All @@ -78,7 +78,7 @@ public class OptionSerializer : ReferenceTypeSerializer<Option<*>> {
fullType: ReferenceType,
staticTyping: Boolean,
typeSerializer: TypeSerializer?,
jsonSerializer: JsonSerializer<Any>?
jsonSerializer: JsonSerializer<Any>?,
) : super(fullType, staticTyping, typeSerializer, jsonSerializer)

public constructor(
Expand All @@ -88,12 +88,12 @@ public class OptionSerializer : ReferenceTypeSerializer<Option<*>> {
valueSer: JsonSerializer<*>?,
unwrapper: NameTransformer?,
suppressableValue: Any?,
suppressNulls: Boolean
suppressNulls: Boolean,
) : super(base, property, typeSerializer, valueSer, unwrapper, suppressableValue, suppressNulls)

override fun withContentInclusion(
suppressableValue: Any?,
suppressNulls: Boolean
suppressNulls: Boolean,
): ReferenceTypeSerializer<Option<*>> =
OptionSerializer(
this,
Expand All @@ -102,7 +102,7 @@ public class OptionSerializer : ReferenceTypeSerializer<Option<*>> {
_valueSerializer,
_unwrapper,
suppressableValue,
suppressNulls
suppressNulls,
)

override fun _isValuePresent(value: Option<*>): Boolean = value.isSome()
Expand All @@ -115,7 +115,7 @@ public class OptionSerializer : ReferenceTypeSerializer<Option<*>> {
prop: BeanProperty?,
vts: TypeSerializer?,
valueSer: JsonSerializer<*>?,
unwrapper: NameTransformer?
unwrapper: NameTransformer?,
): ReferenceTypeSerializer<Option<*>> =
OptionSerializer(this, prop, vts, valueSer, unwrapper, _suppressableValue, _suppressNulls)
}
Expand All @@ -128,7 +128,7 @@ public class OptionDeserializer : JsonDeserializer<Option<*>>(), ContextualDeser

override fun createContextual(
ctxt: DeserializationContext,
property: BeanProperty?
property: BeanProperty?,
): JsonDeserializer<*> {
val valueType =
Option.fromNullable(property)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import com.fasterxml.jackson.databind.jsontype.TypeDeserializer

public data class ElementDeserializer(
val deserializer: Option<JsonDeserializer<*>>,
val typeDeserializer: Option<TypeDeserializer>
val typeDeserializer: Option<TypeDeserializer>,
) {
public companion object {
public fun resolve(
containedType: JavaType,
context: DeserializationContext,
property: BeanProperty?
property: BeanProperty?,
): ElementDeserializer =
ElementDeserializer(
deserializer = context.findContextualValueDeserializer(containedType, property).toOption(),
Expand All @@ -33,15 +33,15 @@ public data class ElementDeserializer(
.findPropertyTypeDeserializer(context.config, containedType, prop.member)
.toOption()
.bind()
}
},
)
}

public fun deserialize(
javaType: JavaType,
token: JsonToken,
parser: JsonParser,
context: DeserializationContext
context: DeserializationContext,
): Any? =
when {
token == JsonToken.VALUE_NULL -> null
Expand All @@ -54,7 +54,7 @@ public data class ElementDeserializer(
javaType.rawClass,
token,
parser,
"no deserializer was found for given type"
"no deserializer was found for given type",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ProductTypeDeserializer<T>(
private val clazz: Class<T>,
private val javaType: JavaType,
private val fields: List<InjectField<T>>,
private val fold: (List<T>) -> T
private val fold: (List<T>) -> T,
) : StdDeserializer<T>(clazz), ContextualDeserializer {
public class InjectField<T>(public val fieldName: String, public val point: (Any?) -> T)

Expand Down Expand Up @@ -56,15 +56,15 @@ public class ProductTypeDeserializer<T>(

override fun createContextual(
ctxt: DeserializationContext,
property: BeanProperty?
property: BeanProperty?,
): JsonDeserializer<*> {
val deserializer = ProductTypeDeserializer(clazz, javaType, fields, fold)
for ((index, field) in fields.withIndex()) {
deserializer.deserializers[field.fieldName] =
ElementDeserializer.resolve(
ctxt.contextualType.containedTypeOrUnknown(index),
ctxt,
property
property,
)
}
return deserializer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ProductTypeSerializer<T>(clazz: Class<T>, private val fields: List<
StdSerializer<T>(clazz) {
public class ProjectField<T>(
public val fieldName: String,
public val getOption: (T) -> Option<*>
public val getOption: (T) -> Option<*>,
)

override fun serialize(value: T, gen: JsonGenerator, provider: SerializerProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public class UnionTypeDeserializer<T>(

override fun createContextual(
ctxt: DeserializationContext,
property: BeanProperty?
property: BeanProperty?,
): JsonDeserializer<*> =
UnionTypeDeserializer(clazz, javaType, fields).also { deserializer ->
fields.forEachIndexed { index, field ->
deserializer.deserializers[field.fieldName] =
ElementDeserializer.resolve(
ctxt.contextualType.containedTypeOrUnknown(index),
ctxt,
property
property,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class UnionTypeSerializer<T>(clazz: Class<T>, private val fields: List<Pr
StdSerializer<T>(clazz) {
public class ProjectField<T>(
public val fieldName: String,
public val getOption: (T) -> Option<*>
public val getOption: (T) -> Option<*>,
)

override fun serialize(value: T, gen: JsonGenerator, provider: SerializerProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class EitherModuleTest {
Arb.pair(Arb.string(10, Codepoint.az()), Arb.string(10, Codepoint.az())).filter {
it.first != it.second
},
arbTestClass
arbTestClass,
) { (leftFieldName, rightFieldName), testClass ->
val mapper =
ObjectMapper()
Expand Down Expand Up @@ -145,7 +145,7 @@ class EitherModuleTest {

private data class Foo(
@get:JsonProperty("foo") val fooValue: Option<Int>,
val otherValue: String
val otherValue: String,
)

private data class Bar(val first: Int, val second: String, val third: Boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ExampleTest {
ArrowUserNel(
"John Doe",
nonEmptyListOf("[email protected]", "[email protected]"),
arrowKt.some()
arrowKt.some(),
)

val jsonString = prettyPrinter.writeValueAsString(arrowUser)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class IorModuleTest {
Arb.pair(Arb.string(10, Codepoint.az()), Arb.string(10, Codepoint.az())).filter {
it.first != it.second
},
arbTestClass
arbTestClass,
) { (leftFieldName, rightFieldName), testClass ->
val mapper =
ObjectMapper()
Expand Down Expand Up @@ -107,7 +107,7 @@ class IorModuleTest {
private enum class IorPolarity {
Left,
Both,
Right
Right,
}

private val arbTestClassJsonString = arbitrary {
Expand Down Expand Up @@ -166,7 +166,7 @@ class IorModuleTest {

private data class Foo(
@get:JsonProperty("foo") val fooValue: Option<Int>,
val otherValue: String
val otherValue: String,
)

private data class Bar(val first: Int, val second: String, val third: Boolean)
Expand All @@ -187,7 +187,7 @@ class IorModuleTest {
Arb.choice(
arbitrary { arbL.bind().leftIor() },
arbitrary { arbR.bind().rightIor() },
arbitrary { (arbL.bind() to arbR.bind()).bothIor() }
arbitrary { (arbL.bind() to arbR.bind()).bothIor() },
)

private val mapper = ObjectMapper().registerKotlinModule().registerArrowModule()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NonEmptyListModuleTest {
},
arbitrary { Arb.nonEmptyList(Arb.int()).bind() to jacksonTypeRef<Nel<Int>>() },
arbitrary { Arb.nonEmptyList(Arb.string()).bind() to jacksonTypeRef<Nel<String>>() },
arbitrary { Arb.nonEmptyList(Arb.boolean()).bind() to jacksonTypeRef<Nel<Boolean>>() }
arbitrary { Arb.nonEmptyList(Arb.boolean()).bind() to jacksonTypeRef<Nel<Boolean>>() },
)
) { (list, typeReference) ->
val encoded: String = mapper.writeValueAsString(list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class NonEmptySetModuleTest {
},
arbitrary {
Arb.nonEmptySet(Arb.boolean()).bind() to jacksonTypeRef<NonEmptySet<Boolean>>()
}
},
)
) { (set, typeReference) ->
val encoded: String = mapper.writeValueAsString(set)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class OptionModuleTest {
arbitrary { Arb.option(Arb.someObject()).bind() to jacksonTypeRef<Option<SomeObject>>() },
arbitrary { Arb.option(Arb.int()).bind() to jacksonTypeRef<Option<Int>>() },
arbitrary { Arb.option(Arb.string()).bind() to jacksonTypeRef<Option<String>>() },
arbitrary { Arb.option(Arb.boolean()).bind() to jacksonTypeRef<Option<Boolean>>() }
arbitrary { Arb.option(Arb.boolean()).bind() to jacksonTypeRef<Option<Boolean>>() },
)
) { (option, typeReference) ->
val encoded = mapper.writeValueAsString(option)
Expand Down
8 changes: 4 additions & 4 deletions gradle/projects.libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[versions]
arrow = "2.0.0"
dokka = "2.0.0"
arrowGradleConfig = "0.12.0-rc.24"
kotlin = "2.0.21"
arrowGradleConfig = "0.12.0-rc.26"
kotlin = "2.1.0"
kotest = "6.0.0.M1"
kotlinBinaryCompatibilityValidator = "0.16.3"
kotlinBinaryCompatibilityValidator = "0.17.0"
detekt = "1.23.7"
animalsniffer = "1.7.2"
jacksonModuleKotlin = "2.18.2"
animalsnifferAnnoation = "1.24"
coroutines = "1.9.0"
coroutines = "1.10.1"

[libraries]
arrowCore = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 6b7ac11

Please sign in to comment.