From 9091d97ae8926474ac1796670f8c4c3848379bbb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 20:35:57 +0000 Subject: [PATCH 1/4] chore(internal): version bump (#374) --- orb-java-core/build.gradle.kts | 1 - .../com/withorb/api/core/ObjectMappers.kt | 57 ----------- .../com/withorb/api/core/ObjectMappersTest.kt | 81 ---------------- .../withorb/api/core/http/SerializerTest.kt | 97 +++++++++++++++++++ 4 files changed, 97 insertions(+), 139 deletions(-) delete mode 100644 orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt create mode 100644 orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt diff --git a/orb-java-core/build.gradle.kts b/orb-java-core/build.gradle.kts index 8a8d05d55..a0bbeafb1 100644 --- a/orb-java-core/build.gradle.kts +++ b/orb-java-core/build.gradle.kts @@ -34,7 +34,6 @@ dependencies { testImplementation("org.assertj:assertj-core:3.25.3") testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3") - testImplementation("org.junit-pioneer:junit-pioneer:1.9.1") testImplementation("org.mockito:mockito-core:5.14.2") testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt index 8710064b4..26311c692 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt @@ -8,11 +8,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.cfg.CoercionAction -import com.fasterxml.jackson.databind.cfg.CoercionInputShape import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule -import com.fasterxml.jackson.databind.type.LogicalType import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.kotlinModule @@ -24,60 +21,6 @@ fun jsonMapper(): JsonMapper = .addModule(Jdk8Module()) .addModule(JavaTimeModule()) .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) - .withCoercionConfig(LogicalType.Boolean) { - it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) - .setCoercion(CoercionInputShape.String, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) - } - .withCoercionConfig(LogicalType.Integer) { - it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) - .setCoercion(CoercionInputShape.String, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) - } - .withCoercionConfig(LogicalType.Float) { - it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) - .setCoercion(CoercionInputShape.String, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) - } - .withCoercionConfig(LogicalType.Textual) { - it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) - } - .withCoercionConfig(LogicalType.Array) { - it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) - .setCoercion(CoercionInputShape.String, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) - } - .withCoercionConfig(LogicalType.Collection) { - it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) - .setCoercion(CoercionInputShape.String, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) - } - .withCoercionConfig(LogicalType.Map) { - it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) - .setCoercion(CoercionInputShape.String, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) - } - .withCoercionConfig(LogicalType.POJO) { - it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) - .setCoercion(CoercionInputShape.String, CoercionAction.Fail) - .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) - } .serializationInclusion(JsonInclude.Include.NON_ABSENT) .disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt deleted file mode 100644 index dcc7b9077..000000000 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.withorb.api.core - -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.exc.MismatchedInputException -import kotlin.reflect.KClass -import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.catchThrowable -import org.junit.jupiter.api.Test -import org.junitpioneer.jupiter.cartesian.CartesianTest - -internal class ObjectMappersTest { - - internal class ClassWithBooleanFieldPrefixedWithIs(private val isActive: JsonField) { - - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - } - - @Test - fun write_whenFieldPrefixedWithIs_keepsPrefix() { - val value = ClassWithBooleanFieldPrefixedWithIs(JsonField.of(true)) - - val json = jsonMapper().writeValueAsString(value) - - assertThat(json).isEqualTo("{\"is_active\":true}") - } - - internal class Class(@get:JsonProperty("field") @JsonProperty("field") val field: String) - - enum class ShapeTestCase(val value: Any, val kClass: KClass<*>) { - STRING("Hello World!", String::class), - BOOLEAN(true, Boolean::class), - FLOAT(3.14F, Float::class), - DOUBLE(3.14, Double::class), - INTEGER(42, Int::class), - LONG(42L, Long::class), - MAP(mapOf("property" to "value"), Map::class), - CLASS(Class("Hello World!"), Class::class), - LIST(listOf(1, 2, 3), List::class); - - companion object { - val VALID_CONVERSIONS = - listOf( - FLOAT to DOUBLE, - FLOAT to INTEGER, - FLOAT to LONG, - DOUBLE to FLOAT, - DOUBLE to INTEGER, - DOUBLE to LONG, - INTEGER to FLOAT, - INTEGER to DOUBLE, - INTEGER to LONG, - LONG to FLOAT, - LONG to DOUBLE, - LONG to INTEGER, - CLASS to MAP, - // These aren't actually valid, but coercion configs don't work for String until - // v2.14.0: https://github.com/FasterXML/jackson-databind/issues/3240 - // We currently test on v2.13.4. - BOOLEAN to STRING, - FLOAT to STRING, - DOUBLE to STRING, - INTEGER to STRING, - LONG to STRING, - ) - } - } - - @CartesianTest - fun read(@CartesianTest.Enum shape1: ShapeTestCase, @CartesianTest.Enum shape2: ShapeTestCase) { - val jsonMapper = jsonMapper() - val json = jsonMapper.writeValueAsString(shape1.value) - - val e = catchThrowable { jsonMapper.readValue(json, shape2.kClass.java) } - - if (shape1 == shape2 || shape1 to shape2 in ShapeTestCase.VALID_CONVERSIONS) { - assertThat(e).isNull() - } else { - assertThat(e).isInstanceOf(MismatchedInputException::class.java) - } - } -} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt new file mode 100644 index 000000000..dae552e24 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt @@ -0,0 +1,97 @@ +package com.withorb.api.core.http + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.withorb.api.core.* +import java.util.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SerializerTest { + @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) + class ClassWithBooleanFieldPrefixedWithIs + private constructor( + private val isActive: JsonField, + private val additionalProperties: Map, + ) { + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun isActive(): Boolean? = isActive.getNullable("is_active") + + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate() = apply { + if (!validated) { + isActive() + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ClassWithBooleanFieldPrefixedWithIs && + isActive == other.isActive && + additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(isActive, additionalProperties) + } + return hashCode + } + + override fun toString() = + "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" + + companion object { + fun builder() = Builder() + } + + class Builder internal constructor() { + + private var isActive: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + + @JsonProperty("is_active") + @ExcludeMissing + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): ClassWithBooleanFieldPrefixedWithIs = + ClassWithBooleanFieldPrefixedWithIs(isActive, additionalProperties.toImmutable()) + } + } + + @Test + fun serializeBooleanPrefixedWithIs() { + val value = ClassWithBooleanFieldPrefixedWithIs.builder().isActive(true).build() + assertThat(jsonMapper().writeValueAsString(value)).isEqualTo("{\"is_active\":true}") + } +} From 80f3b2cedeb031e8ed3417036c1f63cdf9435928 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 20:53:54 +0000 Subject: [PATCH 2/4] chore(internal): codegen related update (#376) --- orb-java-core/build.gradle.kts | 1 + .../com/withorb/api/core/ObjectMappers.kt | 57 +++++++++++ .../com/withorb/api/core/ObjectMappersTest.kt | 81 ++++++++++++++++ .../withorb/api/core/http/SerializerTest.kt | 97 ------------------- 4 files changed, 139 insertions(+), 97 deletions(-) create mode 100644 orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt delete mode 100644 orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt diff --git a/orb-java-core/build.gradle.kts b/orb-java-core/build.gradle.kts index a0bbeafb1..8a8d05d55 100644 --- a/orb-java-core/build.gradle.kts +++ b/orb-java-core/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { testImplementation("org.assertj:assertj-core:3.25.3") testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3") + testImplementation("org.junit-pioneer:junit-pioneer:1.9.1") testImplementation("org.mockito:mockito-core:5.14.2") testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt index 26311c692..8710064b4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt @@ -8,8 +8,11 @@ import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.cfg.CoercionAction +import com.fasterxml.jackson.databind.cfg.CoercionInputShape import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule +import com.fasterxml.jackson.databind.type.LogicalType import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.kotlinModule @@ -21,6 +24,60 @@ fun jsonMapper(): JsonMapper = .addModule(Jdk8Module()) .addModule(JavaTimeModule()) .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) + .withCoercionConfig(LogicalType.Boolean) { + it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Integer) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Float) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Textual) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Array) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Collection) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Map) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.POJO) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + } .serializationInclusion(JsonInclude.Include.NON_ABSENT) .disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt new file mode 100644 index 000000000..dcc7b9077 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt @@ -0,0 +1,81 @@ +package com.withorb.api.core + +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.exc.MismatchedInputException +import kotlin.reflect.KClass +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.catchThrowable +import org.junit.jupiter.api.Test +import org.junitpioneer.jupiter.cartesian.CartesianTest + +internal class ObjectMappersTest { + + internal class ClassWithBooleanFieldPrefixedWithIs(private val isActive: JsonField) { + + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + } + + @Test + fun write_whenFieldPrefixedWithIs_keepsPrefix() { + val value = ClassWithBooleanFieldPrefixedWithIs(JsonField.of(true)) + + val json = jsonMapper().writeValueAsString(value) + + assertThat(json).isEqualTo("{\"is_active\":true}") + } + + internal class Class(@get:JsonProperty("field") @JsonProperty("field") val field: String) + + enum class ShapeTestCase(val value: Any, val kClass: KClass<*>) { + STRING("Hello World!", String::class), + BOOLEAN(true, Boolean::class), + FLOAT(3.14F, Float::class), + DOUBLE(3.14, Double::class), + INTEGER(42, Int::class), + LONG(42L, Long::class), + MAP(mapOf("property" to "value"), Map::class), + CLASS(Class("Hello World!"), Class::class), + LIST(listOf(1, 2, 3), List::class); + + companion object { + val VALID_CONVERSIONS = + listOf( + FLOAT to DOUBLE, + FLOAT to INTEGER, + FLOAT to LONG, + DOUBLE to FLOAT, + DOUBLE to INTEGER, + DOUBLE to LONG, + INTEGER to FLOAT, + INTEGER to DOUBLE, + INTEGER to LONG, + LONG to FLOAT, + LONG to DOUBLE, + LONG to INTEGER, + CLASS to MAP, + // These aren't actually valid, but coercion configs don't work for String until + // v2.14.0: https://github.com/FasterXML/jackson-databind/issues/3240 + // We currently test on v2.13.4. + BOOLEAN to STRING, + FLOAT to STRING, + DOUBLE to STRING, + INTEGER to STRING, + LONG to STRING, + ) + } + } + + @CartesianTest + fun read(@CartesianTest.Enum shape1: ShapeTestCase, @CartesianTest.Enum shape2: ShapeTestCase) { + val jsonMapper = jsonMapper() + val json = jsonMapper.writeValueAsString(shape1.value) + + val e = catchThrowable { jsonMapper.readValue(json, shape2.kClass.java) } + + if (shape1 == shape2 || shape1 to shape2 in ShapeTestCase.VALID_CONVERSIONS) { + assertThat(e).isNull() + } else { + assertThat(e).isInstanceOf(MismatchedInputException::class.java) + } + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt deleted file mode 100644 index dae552e24..000000000 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt +++ /dev/null @@ -1,97 +0,0 @@ -package com.withorb.api.core.http - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.withorb.api.core.* -import java.util.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SerializerTest { - @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) - class ClassWithBooleanFieldPrefixedWithIs - private constructor( - private val isActive: JsonField, - private val additionalProperties: Map, - ) { - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun isActive(): Boolean? = isActive.getNullable("is_active") - - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate() = apply { - if (!validated) { - isActive() - validated = true - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ClassWithBooleanFieldPrefixedWithIs && - isActive == other.isActive && - additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(isActive, additionalProperties) - } - return hashCode - } - - override fun toString() = - "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" - - companion object { - fun builder() = Builder() - } - - class Builder internal constructor() { - - private var isActive: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - - @JsonProperty("is_active") - @ExcludeMissing - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): ClassWithBooleanFieldPrefixedWithIs = - ClassWithBooleanFieldPrefixedWithIs(isActive, additionalProperties.toImmutable()) - } - } - - @Test - fun serializeBooleanPrefixedWithIs() { - val value = ClassWithBooleanFieldPrefixedWithIs.builder().isActive(true).build() - assertThat(jsonMapper().writeValueAsString(value)).isEqualTo("{\"is_active\":true}") - } -} From 2597c3f026fe458cd2dde204753a09872156e945 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 14:55:24 +0000 Subject: [PATCH 3/4] fix: pluralize `list` response variables (#377) --- .../api/services/async/customers/CostServiceAsyncTest.kt | 6 +++--- .../api/services/blocking/customers/CostServiceTest.kt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncTest.kt index 643cf09fc..1c404bc13 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncTest.kt @@ -22,7 +22,7 @@ internal class CostServiceAsyncTest { .build() val costServiceAsync = client.customers().costs() - val costFuture = + val costsFuture = costServiceAsync.list( CustomerCostListParams.builder() .customerId("customer_id") @@ -33,8 +33,8 @@ internal class CostServiceAsyncTest { .build() ) - val cost = costFuture.get() - cost.validate() + val costs = costsFuture.get() + costs.validate() } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt index 483de9324..11e414a04 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt @@ -22,7 +22,7 @@ internal class CostServiceTest { .build() val costService = client.customers().costs() - val cost = + val costs = costService.list( CustomerCostListParams.builder() .customerId("customer_id") @@ -33,7 +33,7 @@ internal class CostServiceTest { .build() ) - cost.validate() + costs.validate() } @Test From 03623dd91e42ecaa7e2fef807b1157aa25416bea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 14:55:55 +0000 Subject: [PATCH 4/4] release: 0.52.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ README.md | 6 +++--- build.gradle.kts | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 97976d55e..5272e554a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.52.1" + ".": "0.52.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a47209843..7719043bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.52.2 (2025-04-01) + +Full Changelog: [v0.52.1...v0.52.2](https://github.com/orbcorp/orb-java/compare/v0.52.1...v0.52.2) + +### Bug Fixes + +* pluralize `list` response variables ([#377](https://github.com/orbcorp/orb-java/issues/377)) ([a5c3fd9](https://github.com/orbcorp/orb-java/commit/a5c3fd99651cab3397ec6233647e011a5468f3b7)) + + +### Chores + +* **internal:** codegen related update ([#376](https://github.com/orbcorp/orb-java/issues/376)) ([bb5383e](https://github.com/orbcorp/orb-java/commit/bb5383eca5483d294c9864d04fa767ae9de1d7e1)) +* **internal:** version bump ([#374](https://github.com/orbcorp/orb-java/issues/374)) ([1ae8e22](https://github.com/orbcorp/orb-java/commit/1ae8e22edff40a5be261fdc2d7ba71860f3a7d42)) + ## 0.52.1 (2025-03-31) Full Changelog: [v0.52.0...v0.52.1](https://github.com/orbcorp/orb-java/compare/v0.52.0...v0.52.1) diff --git a/README.md b/README.md index ba9c139ac..2898dac98 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.52.1) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.52.2) @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho ### Gradle ```kotlin -implementation("com.withorb.api:orb-java:0.52.1") +implementation("com.withorb.api:orb-java:0.52.2") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.52.1") com.withorb.api orb-java - 0.52.1 + 0.52.2 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 3a242454a..153bd1ba9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.52.1" // x-release-please-version + version = "0.52.2" // x-release-please-version }