diff --git a/.fern/metadata.json b/.fern/metadata.json
index dfe97e3..d815e58 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -1,10 +1,10 @@
{
- "cliVersion": "4.29.0",
+ "cliVersion": "4.37.2",
"generatorName": "fernapi/fern-java-sdk",
- "generatorVersion": "3.44.1",
+ "generatorVersion": "4.0.0",
"generatorConfig": {
"publish-to": "central"
},
- "originGitCommit": "bbd2054c67ad246b017399f96faf58cf6737bf01",
- "sdkVersion": "2.0.0"
+ "originGitCommit": "f2b6fc1078e742776b706484940ced855d0f0e74",
+ "sdkVersion": "2.1.0"
}
\ No newline at end of file
diff --git a/.fernignore b/.fernignore
index 7896a51..3a2ac6b 100644
--- a/.fernignore
+++ b/.fernignore
@@ -1,3 +1,4 @@
LICENSE
# README.md
+changelog.md
diff --git a/README.md b/README.md
index 1ac614f..afb653c 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ Add the dependency in your `pom.xml` file:
com.newscatcherapi
newscatcher-sdk
- 2.0.0
+ 2.1.0
```
@@ -334,7 +334,7 @@ The `withRawResponse()` method returns a raw client that wraps all responses wit
(A normal client's `response` is identical to a raw client's `response.body()`.)
```java
-PostHttpResponse response = client.search().withRawResponse().post(...);
+NewscatcherApiHttpResponse response = client.search().withRawResponse().post(...);
System.out.println(response.body());
System.out.println(response.headers().get("X-My-Header"));
@@ -353,3 +353,4 @@ On the other hand, contributions to the README are always very welcome!
For release notes and changelog, visit our [GitHub releases page](https://github.com/Newscatcher/newscatcher-java/releases).
+
diff --git a/build.gradle b/build.gradle
index 19a4cb8..dda67db 100644
--- a/build.gradle
+++ b/build.gradle
@@ -47,7 +47,7 @@ java {
group = 'com.newscatcherapi'
-version = '2.0.0'
+version = '2.1.0'
jar {
dependsOn(":generatePomFileForMavenPublication")
@@ -78,7 +78,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.newscatcherapi'
artifactId = 'newscatcher-sdk'
- version = '2.0.0'
+ version = '2.1.0'
from components.java
pom {
name = 'newscatcher'
diff --git a/changelog.md b/changelog.md
new file mode 100644
index 0000000..42619a6
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,3 @@
+## 2.1.0 - 2026-03-19
+* The SDK now serializes integer-valued doubles without decimal points (e.g., "24000" instead of "24000.0") for cleaner JSON output. This change affects the wire format but maintains full type compatibility.
+
diff --git a/src/main/java/com/newscatcher/api/core/ClientOptions.java b/src/main/java/com/newscatcher/api/core/ClientOptions.java
index 8b1bf29..0651c5c 100644
--- a/src/main/java/com/newscatcher/api/core/ClientOptions.java
+++ b/src/main/java/com/newscatcher/api/core/ClientOptions.java
@@ -38,10 +38,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap() {
{
- put("User-Agent", "com.newscatcherapi:newscatcher-sdk/2.0.0");
+ put("User-Agent", "com.newscatcherapi:newscatcher-sdk/2.1.0");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.newscatcher.fern:api-sdk");
- put("X-Fern-SDK-Version", "2.0.0");
+ put("X-Fern-SDK-Version", "2.1.0");
}
});
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/com/newscatcher/api/core/DoubleSerializer.java b/src/main/java/com/newscatcher/api/core/DoubleSerializer.java
new file mode 100644
index 0000000..e3cb0e9
--- /dev/null
+++ b/src/main/java/com/newscatcher/api/core/DoubleSerializer.java
@@ -0,0 +1,43 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.newscatcher.api.core;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import java.io.IOException;
+
+/**
+ * Custom serializer that writes integer-valued doubles without a decimal point.
+ * For example, {@code 24000.0} is serialized as {@code 24000} instead of {@code 24000.0}.
+ * Non-integer values like {@code 3.14} are serialized normally.
+ */
+class DoubleSerializer extends JsonSerializer {
+ private static final SimpleModule MODULE;
+
+ static {
+ MODULE = new SimpleModule()
+ .addSerializer(Double.class, new DoubleSerializer())
+ .addSerializer(double.class, new DoubleSerializer());
+ }
+
+ /**
+ * Gets a module wrapping this serializer as an adapter for the Jackson ObjectMapper.
+ *
+ * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper.
+ */
+ public static SimpleModule getModule() {
+ return MODULE;
+ }
+
+ @Override
+ public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
+ if (value != null && value == Math.floor(value) && !Double.isInfinite(value) && !Double.isNaN(value)) {
+ gen.writeNumber(value.longValue());
+ } else {
+ gen.writeNumber(value);
+ }
+ }
+}
diff --git a/src/main/java/com/newscatcher/api/core/ObjectMappers.java b/src/main/java/com/newscatcher/api/core/ObjectMappers.java
index 8e78be8..315f90b 100644
--- a/src/main/java/com/newscatcher/api/core/ObjectMappers.java
+++ b/src/main/java/com/newscatcher/api/core/ObjectMappers.java
@@ -18,6 +18,7 @@ public final class ObjectMappers {
.addModule(new Jdk8Module())
.addModule(new JavaTimeModule())
.addModule(DateTimeDeserializer.getModule())
+ .addModule(DoubleSerializer.getModule())
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.build();