Skip to content

Commit 6f5a264

Browse files
chore(internal): remove redundant deserializer symbols
1 parent 3943bb0 commit 6f5a264

File tree

2 files changed

+0
-112
lines changed

2 files changed

+0
-112
lines changed

openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateParams.kt

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@ import com.fasterxml.jackson.annotation.JsonAnySetter
77
import com.fasterxml.jackson.annotation.JsonCreator
88
import com.fasterxml.jackson.annotation.JsonProperty
99
import com.fasterxml.jackson.core.JsonGenerator
10-
import com.fasterxml.jackson.core.ObjectCodec
11-
import com.fasterxml.jackson.databind.JsonNode
1210
import com.fasterxml.jackson.databind.SerializerProvider
13-
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
1411
import com.fasterxml.jackson.databind.annotation.JsonSerialize
15-
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
16-
import com.openai.core.BaseDeserializer
1712
import com.openai.core.BaseSerializer
1813
import com.openai.core.Enum
1914
import com.openai.core.ExcludeMissing
2015
import com.openai.core.JsonField
2116
import com.openai.core.JsonValue
2217
import com.openai.core.MultipartField
2318
import com.openai.core.Params
24-
import com.openai.core.allMaxBy
2519
import com.openai.core.checkKnown
2620
import com.openai.core.checkRequired
2721
import com.openai.core.getOrThrow
@@ -1220,7 +1214,6 @@ private constructor(
12201214
* object can be provided to tweak VAD detection parameters manually. If unset, the audio is
12211215
* transcribed as a single block.
12221216
*/
1223-
@JsonDeserialize(using = ChunkingStrategy.Deserializer::class)
12241217
@JsonSerialize(using = ChunkingStrategy.Serializer::class)
12251218
class ChunkingStrategy
12261219
private constructor(
@@ -1285,25 +1278,6 @@ private constructor(
12851278
false
12861279
}
12871280

1288-
/**
1289-
* Returns a score indicating how many valid values are contained in this object
1290-
* recursively.
1291-
*
1292-
* Used for best match union deserialization.
1293-
*/
1294-
@JvmSynthetic
1295-
internal fun validity(): Int =
1296-
accept(
1297-
object : Visitor<Int> {
1298-
override fun visitAuto(auto: JsonValue) =
1299-
auto.let { if (it == JsonValue.from("auto")) 1 else 0 }
1300-
1301-
override fun visitVadConfig(vadConfig: VadConfig) = 1
1302-
1303-
override fun unknown(json: JsonValue?) = 0
1304-
}
1305-
)
1306-
13071281
override fun equals(other: Any?): Boolean {
13081282
if (this === other) {
13091283
return true
@@ -1361,36 +1335,6 @@ private constructor(
13611335
}
13621336
}
13631337

1364-
internal class Deserializer : BaseDeserializer<ChunkingStrategy>(ChunkingStrategy::class) {
1365-
1366-
override fun ObjectCodec.deserialize(node: JsonNode): ChunkingStrategy {
1367-
val json = JsonValue.fromJsonNode(node)
1368-
1369-
val bestMatches =
1370-
sequenceOf(
1371-
tryDeserialize(node, jacksonTypeRef<JsonValue>())
1372-
?.let { ChunkingStrategy(auto = it, _json = json) }
1373-
?.takeIf { it.isValid() },
1374-
tryDeserialize(node, jacksonTypeRef<VadConfig>())?.let {
1375-
ChunkingStrategy(vadConfig = it, _json = json)
1376-
},
1377-
)
1378-
.filterNotNull()
1379-
.allMaxBy { it.validity() }
1380-
.toList()
1381-
return when (bestMatches.size) {
1382-
// This can happen if what we're deserializing is completely incompatible with
1383-
// all the possible variants (e.g. deserializing from array).
1384-
0 -> ChunkingStrategy(_json = json)
1385-
1 -> bestMatches.single()
1386-
// If there's more than one match with the highest validity, then use the first
1387-
// completely valid match, or simply the first match if none are completely
1388-
// valid.
1389-
else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
1390-
}
1391-
}
1392-
}
1393-
13941338
internal class Serializer : BaseSerializer<ChunkingStrategy>(ChunkingStrategy::class) {
13951339

13961340
override fun serialize(

openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@ import com.fasterxml.jackson.annotation.JsonAnySetter
77
import com.fasterxml.jackson.annotation.JsonCreator
88
import com.fasterxml.jackson.annotation.JsonProperty
99
import com.fasterxml.jackson.core.JsonGenerator
10-
import com.fasterxml.jackson.core.ObjectCodec
11-
import com.fasterxml.jackson.databind.JsonNode
1210
import com.fasterxml.jackson.databind.SerializerProvider
13-
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
1411
import com.fasterxml.jackson.databind.annotation.JsonSerialize
15-
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
16-
import com.openai.core.BaseDeserializer
1712
import com.openai.core.BaseSerializer
1813
import com.openai.core.Enum
1914
import com.openai.core.ExcludeMissing
2015
import com.openai.core.JsonField
2116
import com.openai.core.JsonValue
2217
import com.openai.core.MultipartField
2318
import com.openai.core.Params
24-
import com.openai.core.allMaxBy
2519
import com.openai.core.checkRequired
2620
import com.openai.core.getOrThrow
2721
import com.openai.core.http.Headers
@@ -1729,7 +1723,6 @@ private constructor(
17291723
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
17301724
* than 4MB.
17311725
*/
1732-
@JsonDeserialize(using = Image.Deserializer::class)
17331726
@JsonSerialize(using = Image.Serializer::class)
17341727
class Image
17351728
private constructor(
@@ -1784,25 +1777,6 @@ private constructor(
17841777
false
17851778
}
17861779

1787-
/**
1788-
* Returns a score indicating how many valid values are contained in this object
1789-
* recursively.
1790-
*
1791-
* Used for best match union deserialization.
1792-
*/
1793-
@JvmSynthetic
1794-
internal fun validity(): Int =
1795-
accept(
1796-
object : Visitor<Int> {
1797-
override fun visitInputStream(inputStream: InputStream) = 1
1798-
1799-
override fun visitInputStreams(inputStreams: List<InputStream>) =
1800-
inputStreams.size
1801-
1802-
override fun unknown(json: JsonValue?) = 0
1803-
}
1804-
)
1805-
18061780
override fun equals(other: Any?): Boolean {
18071781
if (this === other) {
18081782
return true
@@ -1855,36 +1829,6 @@ private constructor(
18551829
}
18561830
}
18571831

1858-
internal class Deserializer : BaseDeserializer<Image>(Image::class) {
1859-
1860-
override fun ObjectCodec.deserialize(node: JsonNode): Image {
1861-
val json = JsonValue.fromJsonNode(node)
1862-
1863-
val bestMatches =
1864-
sequenceOf(
1865-
tryDeserialize(node, jacksonTypeRef<InputStream>())?.let {
1866-
Image(inputStream = it, _json = json)
1867-
},
1868-
tryDeserialize(node, jacksonTypeRef<List<InputStream>>())?.let {
1869-
Image(inputStreams = it, _json = json)
1870-
},
1871-
)
1872-
.filterNotNull()
1873-
.allMaxBy { it.validity() }
1874-
.toList()
1875-
return when (bestMatches.size) {
1876-
// This can happen if what we're deserializing is completely incompatible with
1877-
// all the possible variants (e.g. deserializing from object).
1878-
0 -> Image(_json = json)
1879-
1 -> bestMatches.single()
1880-
// If there's more than one match with the highest validity, then use the first
1881-
// completely valid match, or simply the first match if none are completely
1882-
// valid.
1883-
else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
1884-
}
1885-
}
1886-
}
1887-
18881832
internal class Serializer : BaseSerializer<Image>(Image::class) {
18891833

18901834
override fun serialize(

0 commit comments

Comments
 (0)