Skip to content

Commit 2d52469

Browse files
chore(internal): remove redundant deserializer symbols
1 parent c75a767 commit 2d52469

File tree

2 files changed

+0
-378
lines changed

2 files changed

+0
-378
lines changed

image-kit-java-core/src/main/kotlin/com/imagekit/api/models/beta/v2/files/FileUploadParams.kt

Lines changed: 0 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ 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.imagekit.api.core.BaseDeserializer
1712
import com.imagekit.api.core.BaseSerializer
1813
import com.imagekit.api.core.Enum
1914
import com.imagekit.api.core.ExcludeMissing
@@ -37,7 +32,6 @@ import java.util.Objects
3732
import java.util.Optional
3833
import kotlin.io.path.inputStream
3934
import kotlin.io.path.name
40-
import kotlin.jvm.optionals.getOrNull
4135

4236
/**
4337
* The V2 API enhances security by verifying the entire payload using JWT. This API is in beta.
@@ -2318,7 +2312,6 @@ private constructor(
23182312
override fun toString() = "CustomMetadata{additionalProperties=$additionalProperties}"
23192313
}
23202314

2321-
@JsonDeserialize(using = UnnamedSchemaWithArrayParent1.Deserializer::class)
23222315
@JsonSerialize(using = UnnamedSchemaWithArrayParent1.Serializer::class)
23232316
class UnnamedSchemaWithArrayParent1
23242317
private constructor(
@@ -2400,32 +2393,6 @@ private constructor(
24002393
false
24012394
}
24022395

2403-
/**
2404-
* Returns a score indicating how many valid values are contained in this object
2405-
* recursively.
2406-
*
2407-
* Used for best match union deserialization.
2408-
*/
2409-
@JvmSynthetic
2410-
internal fun validity(): Int =
2411-
accept(
2412-
object : Visitor<Int> {
2413-
override fun visitRemoveBg(removeBg: RemoveBg) = removeBg.validity()
2414-
2415-
override fun visitAutoTaggingExtension(
2416-
autoTaggingExtension: AutoTaggingExtension
2417-
) = autoTaggingExtension.validity()
2418-
2419-
override fun visitAiAutoDescription(aiAutoDescription: JsonValue) =
2420-
aiAutoDescription.let {
2421-
if (it == JsonValue.from(mapOf("name" to "ai-auto-description"))) 1
2422-
else 0
2423-
}
2424-
2425-
override fun unknown(json: JsonValue?) = 0
2426-
}
2427-
)
2428-
24292396
override fun equals(other: Any?): Boolean {
24302397
if (this === other) {
24312398
return true
@@ -2494,34 +2461,6 @@ private constructor(
24942461
}
24952462
}
24962463

2497-
internal class Deserializer :
2498-
BaseDeserializer<UnnamedSchemaWithArrayParent1>(UnnamedSchemaWithArrayParent1::class) {
2499-
2500-
override fun ObjectCodec.deserialize(node: JsonNode): UnnamedSchemaWithArrayParent1 {
2501-
val json = JsonValue.fromJsonNode(node)
2502-
val name = json.asObject().getOrNull()?.get("name")?.asString()?.getOrNull()
2503-
2504-
when (name) {
2505-
"remove-bg" -> {
2506-
return tryDeserialize(node, jacksonTypeRef<RemoveBg>())?.let {
2507-
UnnamedSchemaWithArrayParent1(removeBg = it, _json = json)
2508-
} ?: UnnamedSchemaWithArrayParent1(_json = json)
2509-
}
2510-
"ai-auto-description" -> {
2511-
return tryDeserialize(node, jacksonTypeRef<JsonValue>())
2512-
?.let {
2513-
UnnamedSchemaWithArrayParent1(aiAutoDescription = it, _json = json)
2514-
}
2515-
?.takeIf { it.isValid() } ?: UnnamedSchemaWithArrayParent1(_json = json)
2516-
}
2517-
}
2518-
2519-
return tryDeserialize(node, jacksonTypeRef<AutoTaggingExtension>())?.let {
2520-
UnnamedSchemaWithArrayParent1(autoTaggingExtension = it, _json = json)
2521-
} ?: UnnamedSchemaWithArrayParent1(_json = json)
2522-
}
2523-
}
2524-
25252464
internal class Serializer :
25262465
BaseSerializer<UnnamedSchemaWithArrayParent1>(UnnamedSchemaWithArrayParent1::class) {
25272466

@@ -2549,14 +2488,6 @@ private constructor(
25492488
private val additionalProperties: MutableMap<String, JsonValue>,
25502489
) {
25512490

2552-
@JsonCreator
2553-
private constructor(
2554-
@JsonProperty("name") @ExcludeMissing name: JsonValue = JsonMissing.of(),
2555-
@JsonProperty("options")
2556-
@ExcludeMissing
2557-
options: JsonField<Options> = JsonMissing.of(),
2558-
) : this(name, options, mutableMapOf())
2559-
25602491
/**
25612492
* Specifies the background removal extension.
25622493
*
@@ -2694,17 +2625,6 @@ private constructor(
26942625
false
26952626
}
26962627

2697-
/**
2698-
* Returns a score indicating how many valid values are contained in this object
2699-
* recursively.
2700-
*
2701-
* Used for best match union deserialization.
2702-
*/
2703-
@JvmSynthetic
2704-
internal fun validity(): Int =
2705-
name.let { if (it == JsonValue.from("remove-bg")) 1 else 0 } +
2706-
(options.asKnown().getOrNull()?.validity() ?: 0)
2707-
27082628
class Options
27092629
private constructor(
27102630
private val addShadow: JsonField<Boolean>,
@@ -2714,22 +2634,6 @@ private constructor(
27142634
private val additionalProperties: MutableMap<String, JsonValue>,
27152635
) {
27162636

2717-
@JsonCreator
2718-
private constructor(
2719-
@JsonProperty("add_shadow")
2720-
@ExcludeMissing
2721-
addShadow: JsonField<Boolean> = JsonMissing.of(),
2722-
@JsonProperty("bg_color")
2723-
@ExcludeMissing
2724-
bgColor: JsonField<String> = JsonMissing.of(),
2725-
@JsonProperty("bg_image_url")
2726-
@ExcludeMissing
2727-
bgImageUrl: JsonField<String> = JsonMissing.of(),
2728-
@JsonProperty("semitransparency")
2729-
@ExcludeMissing
2730-
semitransparency: JsonField<Boolean> = JsonMissing.of(),
2731-
) : this(addShadow, bgColor, bgImageUrl, semitransparency, mutableMapOf())
2732-
27332637
/**
27342638
* Whether to add an artificial shadow to the result. Default is false. Note: Adding
27352639
* shadows is currently only supported for car photos.
@@ -2971,19 +2875,6 @@ private constructor(
29712875
false
29722876
}
29732877

2974-
/**
2975-
* Returns a score indicating how many valid values are contained in this object
2976-
* recursively.
2977-
*
2978-
* Used for best match union deserialization.
2979-
*/
2980-
@JvmSynthetic
2981-
internal fun validity(): Int =
2982-
(if (addShadow.asKnown().isPresent) 1 else 0) +
2983-
(if (bgColor.asKnown().isPresent) 1 else 0) +
2984-
(if (bgImageUrl.asKnown().isPresent) 1 else 0) +
2985-
(if (semitransparency.asKnown().isPresent) 1 else 0)
2986-
29872878
override fun equals(other: Any?): Boolean {
29882879
if (this === other) {
29892880
return true
@@ -3040,17 +2931,6 @@ private constructor(
30402931
private val additionalProperties: MutableMap<String, JsonValue>,
30412932
) {
30422933

3043-
@JsonCreator
3044-
private constructor(
3045-
@JsonProperty("maxTags")
3046-
@ExcludeMissing
3047-
maxTags: JsonField<Long> = JsonMissing.of(),
3048-
@JsonProperty("minConfidence")
3049-
@ExcludeMissing
3050-
minConfidence: JsonField<Long> = JsonMissing.of(),
3051-
@JsonProperty("name") @ExcludeMissing name: JsonField<Name> = JsonMissing.of(),
3052-
) : this(maxTags, minConfidence, name, mutableMapOf())
3053-
30542934
/**
30552935
* Maximum number of tags to attach to the asset.
30562936
*
@@ -3249,18 +3129,6 @@ private constructor(
32493129
false
32503130
}
32513131

3252-
/**
3253-
* Returns a score indicating how many valid values are contained in this object
3254-
* recursively.
3255-
*
3256-
* Used for best match union deserialization.
3257-
*/
3258-
@JvmSynthetic
3259-
internal fun validity(): Int =
3260-
(if (maxTags.asKnown().isPresent) 1 else 0) +
3261-
(if (minConfidence.asKnown().isPresent) 1 else 0) +
3262-
(name.asKnown().getOrNull()?.validity() ?: 0)
3263-
32643132
/** Specifies the auto-tagging extension used. */
32653133
class Name @JsonCreator private constructor(private val value: JsonField<String>) :
32663134
Enum {
@@ -3776,7 +3644,6 @@ private constructor(
37763644
false
37773645
}
37783646

3779-
@JsonDeserialize(using = Post.Deserializer::class)
37803647
@JsonSerialize(using = Post.Serializer::class)
37813648
class Post
37823649
private constructor(
@@ -3861,29 +3728,6 @@ private constructor(
38613728
false
38623729
}
38633730

3864-
/**
3865-
* Returns a score indicating how many valid values are contained in this object
3866-
* recursively.
3867-
*
3868-
* Used for best match union deserialization.
3869-
*/
3870-
@JvmSynthetic
3871-
internal fun validity(): Int =
3872-
accept(
3873-
object : Visitor<Int> {
3874-
override fun visitTransformation(transformation: InnerTransformation) =
3875-
transformation.validity()
3876-
3877-
override fun visitGifToVideo(gifToVideo: GifToVideo) = gifToVideo.validity()
3878-
3879-
override fun visitThumbnail(thumbnail: Thumbnail) = thumbnail.validity()
3880-
3881-
override fun visitAbs(abs: Abs) = abs.validity()
3882-
3883-
override fun unknown(json: JsonValue?) = 0
3884-
}
3885-
)
3886-
38873731
override fun equals(other: Any?): Boolean {
38883732
if (this === other) {
38893733
return true
@@ -3949,39 +3793,6 @@ private constructor(
39493793
}
39503794
}
39513795

3952-
internal class Deserializer : BaseDeserializer<Post>(Post::class) {
3953-
3954-
override fun ObjectCodec.deserialize(node: JsonNode): Post {
3955-
val json = JsonValue.fromJsonNode(node)
3956-
val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
3957-
3958-
when (type) {
3959-
"transformation" -> {
3960-
return tryDeserialize(node, jacksonTypeRef<InnerTransformation>())
3961-
?.let { Post(transformation = it, _json = json) }
3962-
?: Post(_json = json)
3963-
}
3964-
"gif-to-video" -> {
3965-
return tryDeserialize(node, jacksonTypeRef<GifToVideo>())?.let {
3966-
Post(gifToVideo = it, _json = json)
3967-
} ?: Post(_json = json)
3968-
}
3969-
"thumbnail" -> {
3970-
return tryDeserialize(node, jacksonTypeRef<Thumbnail>())?.let {
3971-
Post(thumbnail = it, _json = json)
3972-
} ?: Post(_json = json)
3973-
}
3974-
"abs" -> {
3975-
return tryDeserialize(node, jacksonTypeRef<Abs>())?.let {
3976-
Post(abs = it, _json = json)
3977-
} ?: Post(_json = json)
3978-
}
3979-
}
3980-
3981-
return Post(_json = json)
3982-
}
3983-
}
3984-
39853796
internal class Serializer : BaseSerializer<Post>(Post::class) {
39863797

39873798
override fun serialize(

0 commit comments

Comments
 (0)