Skip to content

Commit b41ad12

Browse files
committed
lint
1 parent ff2800f commit b41ad12

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/commonMain/kotlin/com.adamratzman.spotify/models/serialization/SerializationUtils.kt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ import kotlinx.serialization.json.JsonObject
2222
internal val nonstrictJson =
2323
Json(
2424
JsonConfiguration(
25-
isLenient = true,
26-
ignoreUnknownKeys = true,
27-
serializeSpecialFloatingPointValues = true,
28-
useArrayPolymorphism = true
29-
)
25+
isLenient = true,
26+
ignoreUnknownKeys = true,
27+
serializeSpecialFloatingPointValues = true,
28+
useArrayPolymorphism = true
29+
)
3030
)
3131

3232
internal inline fun <reified T : Any> String.toObjectNullable(serializer: KSerializer<T>, api: SpotifyApi<*, *>?, json: Json): T? = try {
@@ -72,7 +72,8 @@ internal fun <T : Any> String.toPagingObject(
7272
if (innerObjectName != null || (arbitraryInnerNameAllowed && !skipInnerNameFirstIfPossible)) {
7373
val map = this.parseJson {
7474
val t = (String.serializer() to PagingObject.serializer(tSerializer))
75-
json.parse(MapSerializer(t.first, t.second), this) }
75+
json.parse(MapSerializer(t.first, t.second), this)
76+
}
7677
return (map[innerObjectName] ?: if (arbitraryInnerNameAllowed) map.keys.firstOrNull()?.let { map[it] }
7778
?: error("") else error(""))
7879
.apply {
@@ -143,7 +144,8 @@ internal fun <T : Any> String.toCursorBasedPagingObject(
143144
if (innerObjectName != null || (arbitraryInnerNameAllowed && !skipInnerNameFirstIfPossible)) {
144145
val map = this.parseJson {
145146
val t = (String.serializer() to CursorBasedPagingObject.serializer(tSerializer))
146-
json.parse(MapSerializer(t.first, t.second), this) }
147+
json.parse(MapSerializer(t.first, t.second), this)
148+
}
147149
return (map[innerObjectName] ?: if (arbitraryInnerNameAllowed) map.keys.firstOrNull()?.let { map[it] }
148150
?: error("") else error(""))
149151
.apply { initPagingObject(tClazz, this, endpoint) }
@@ -182,14 +184,16 @@ internal inline fun <reified T : Any> String.toCursorBasedPagingObject(
182184
internal inline fun <reified T> String.toInnerObject(serializer: KSerializer<T>, innerName: String, json: Json): T {
183185
val map = this.parseJson {
184186
val t = (String.serializer() to serializer)
185-
json.parse(MapSerializer(t.first, t.second), this) }
187+
json.parse(MapSerializer(t.first, t.second), this)
188+
}
186189
return (map[innerName] ?: error("Inner object with name $innerName doesn't exist in $map"))
187190
}
188191

189192
internal inline fun <reified T> String.toInnerArray(serializer: KSerializer<List<T>>, innerName: String, json: Json): List<T> {
190193
val map = this.parseJson {
191194
val t = (String.serializer() to serializer)
192-
json.parse(MapSerializer(t.first, t.second), this) }
195+
json.parse(MapSerializer(t.first, t.second), this)
196+
}
193197
return (map[innerName] ?: error("Inner object with name $innerName doesn't exist in $map")).toList()
194198
}
195199

0 commit comments

Comments
 (0)