Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: |
Expand All @@ -47,10 +47,10 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: |
Expand Down Expand Up @@ -85,10 +85,10 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/open-transit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-sonatype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.repository == 'OneBusAway/java-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Check release environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.46"
".": "0.1.0-alpha.47"
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.1.0-alpha.47 (2026-01-17)

Full Changelog: [v0.1.0-alpha.46...v0.1.0-alpha.47](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.46...v0.1.0-alpha.47)

### Bug Fixes

* **client:** disallow coercion from float to int ([7455e7f](https://github.com/OneBusAway/java-sdk/commit/7455e7fabfca0fa03bae97ffe09afc993f153d64))
* **client:** fully respect max retries ([814f38c](https://github.com/OneBusAway/java-sdk/commit/814f38ce0cba11f4517205d2834d324ad62368dd))
* **client:** send retry count header for max retries 0 ([814f38c](https://github.com/OneBusAway/java-sdk/commit/814f38ce0cba11f4517205d2834d324ad62368dd))
* date time deserialization leniency ([32945ab](https://github.com/OneBusAway/java-sdk/commit/32945ab3cebb1771692105447c58669a1b015b66))


### Chores

* **ci:** upgrade `actions/setup-java` ([efba5c4](https://github.com/OneBusAway/java-sdk/commit/efba5c4cfd981b9a40888f32fef1d8813d46b076))
* **internal:** clean up maven repo artifact script and add html documentation to repo root ([75e739a](https://github.com/OneBusAway/java-sdk/commit/75e739ad6e188354083dc1edd80e2d5c4ce848dc))
* **internal:** depend on packages directly in example ([814f38c](https://github.com/OneBusAway/java-sdk/commit/814f38ce0cba11f4517205d2834d324ad62368dd))
* **internal:** improve maven repo docs ([214feba](https://github.com/OneBusAway/java-sdk/commit/214feba0154c64ddcfbe4142a18c581e5167074b))
* **internal:** update `actions/checkout` version ([e69a85a](https://github.com/OneBusAway/java-sdk/commit/e69a85a1cef632cfe7519003453cd73cf707d279))
* test on Jackson 2.14.0 to avoid encountering FasterXML/jackson-databind[#3240](https://github.com/OneBusAway/java-sdk/issues/3240) in tests ([32945ab](https://github.com/OneBusAway/java-sdk/commit/32945ab3cebb1771692105447c58669a1b015b66))

## 0.1.0-alpha.46 (2026-01-13)

Full Changelog: [v0.1.0-alpha.45...v0.1.0-alpha.46](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.45...v0.1.0-alpha.46)
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46)
[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.47)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.47/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.47)

<!-- x-release-please-end -->

Expand All @@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).

<!-- x-release-please-start-version -->

The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.46).
The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.47).

<!-- x-release-please-end -->

Expand All @@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.onebusaway.org](https://de
### Gradle

```kotlin
implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.46")
implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.47")
```

### Maven
Expand All @@ -35,7 +35,7 @@ implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.46")
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-sdk-java</artifactId>
<version>0.1.0-alpha.46</version>
<version>0.1.0-alpha.47</version>
</dependency>
```

Expand Down Expand Up @@ -260,6 +260,8 @@ If the SDK threw an exception, but you're _certain_ the version is compatible, t
> [!CAUTION]
> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.

Also note that there are bugs in older Jackson versions that can affect the SDK. We don't work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.

## Network options

### Retries
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "org.onebusaway"
version = "0.1.0-alpha.46" // x-release-please-version
version = "0.1.0-alpha.47" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
fun build(): OkHttpClient =
OkHttpClient(
okhttp3.OkHttpClient.Builder()
// `RetryingHttpClient` handles retries if the user enabled them.
.retryOnConnectionFailure(false)
.connectTimeout(timeout.connect())
.readTimeout(timeout.read())
.writeTimeout(timeout.write())
Expand Down
18 changes: 10 additions & 8 deletions onebusaway-sdk-java-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ plugins {

configurations.all {
resolutionStrategy {
// Compile and test against a lower Jackson version to ensure we're compatible with it.
// We publish with a higher version (see below) to ensure users depend on a secure version by default.
force("com.fasterxml.jackson.core:jackson-core:2.13.4")
force("com.fasterxml.jackson.core:jackson-databind:2.13.4")
force("com.fasterxml.jackson.core:jackson-annotations:2.13.4")
force("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.4")
force("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4")
force("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4")
// Compile and test against a lower Jackson version to ensure we're compatible with it. Note that
// we generally support 2.13.4, but test against 2.14.0 because 2.13.4 has some annoying (but
// niche) bugs (users should upgrade if they encounter them). We publish with a higher version
// (see below) to ensure users depend on a secure version by default.
force("com.fasterxml.jackson.core:jackson-core:2.14.0")
force("com.fasterxml.jackson.core:jackson-databind:2.14.0")
force("com.fasterxml.jackson.core:jackson-annotations:2.14.0")
force("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.14.0")
force("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.0")
force("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import java.io.InputStream
import java.time.DateTimeException
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.OffsetDateTime
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoField
Expand All @@ -36,7 +37,7 @@ fun jsonMapper(): JsonMapper =
.addModule(
SimpleModule()
.addSerializer(InputStreamSerializer)
.addDeserializer(LocalDateTime::class.java, LenientLocalDateTimeDeserializer())
.addDeserializer(OffsetDateTime::class.java, LenientOffsetDateTimeDeserializer())
)
.withCoercionConfig(LogicalType.Boolean) {
it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail)
Expand All @@ -47,6 +48,7 @@ fun jsonMapper(): JsonMapper =
}
.withCoercionConfig(LogicalType.Integer) {
it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail)
.setCoercion(CoercionInputShape.Float, CoercionAction.Fail)
.setCoercion(CoercionInputShape.String, CoercionAction.Fail)
.setCoercion(CoercionInputShape.Array, CoercionAction.Fail)
.setCoercion(CoercionInputShape.Object, CoercionAction.Fail)
Expand All @@ -64,6 +66,12 @@ fun jsonMapper(): JsonMapper =
.setCoercion(CoercionInputShape.Array, CoercionAction.Fail)
.setCoercion(CoercionInputShape.Object, CoercionAction.Fail)
}
.withCoercionConfig(LogicalType.DateTime) {
it.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)
Expand Down Expand Up @@ -124,10 +132,10 @@ private object InputStreamSerializer : BaseSerializer<InputStream>(InputStream::
}

/**
* A deserializer that can deserialize [LocalDateTime] from datetimes, dates, and zoned datetimes.
* A deserializer that can deserialize [OffsetDateTime] from datetimes, dates, and zoned datetimes.
*/
private class LenientLocalDateTimeDeserializer :
StdDeserializer<LocalDateTime>(LocalDateTime::class.java) {
private class LenientOffsetDateTimeDeserializer :
StdDeserializer<OffsetDateTime>(OffsetDateTime::class.java) {

companion object {

Expand All @@ -141,26 +149,28 @@ private class LenientLocalDateTimeDeserializer :

override fun logicalType(): LogicalType = LogicalType.DateTime

override fun deserialize(p: JsonParser, context: DeserializationContext?): LocalDateTime {
override fun deserialize(p: JsonParser, context: DeserializationContext): OffsetDateTime {
val exceptions = mutableListOf<Exception>()

for (formatter in DATE_TIME_FORMATTERS) {
try {
val temporal = formatter.parse(p.text)

return when {
!temporal.isSupported(ChronoField.HOUR_OF_DAY) ->
LocalDate.from(temporal).atStartOfDay()
!temporal.isSupported(ChronoField.OFFSET_SECONDS) ->
LocalDateTime.from(temporal)
else -> ZonedDateTime.from(temporal).toLocalDateTime()
}
!temporal.isSupported(ChronoField.HOUR_OF_DAY) ->
LocalDate.from(temporal).atStartOfDay()
!temporal.isSupported(ChronoField.OFFSET_SECONDS) ->
LocalDateTime.from(temporal)
else -> ZonedDateTime.from(temporal).toLocalDateTime()
}
.atZone(context.timeZone.toZoneId())
.toOffsetDateTime()
} catch (e: DateTimeException) {
exceptions.add(e)
}
}

throw JsonParseException(p, "Cannot parse `LocalDateTime` from value: ${p.text}").apply {
throw JsonParseException(p, "Cannot parse `OffsetDateTime` from value: ${p.text}").apply {
exceptions.forEach { addSuppressed(it) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ private constructor(
) : HttpClient {

override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
if (!isRetryable(request) || maxRetries <= 0) {
return httpClient.execute(request, requestOptions)
}

var modifiedRequest = maybeAddIdempotencyHeader(request)

// Don't send the current retry count in the headers if the caller set their own value.
Expand All @@ -48,6 +44,10 @@ private constructor(
modifiedRequest = setRetryCountHeader(modifiedRequest, retries)
}

if (!isRetryable(modifiedRequest)) {
return httpClient.execute(modifiedRequest, requestOptions)
}

val response =
try {
val response = httpClient.execute(modifiedRequest, requestOptions)
Expand Down Expand Up @@ -75,10 +75,6 @@ private constructor(
request: HttpRequest,
requestOptions: RequestOptions,
): CompletableFuture<HttpResponse> {
if (!isRetryable(request) || maxRetries <= 0) {
return httpClient.executeAsync(request, requestOptions)
}

val modifiedRequest = maybeAddIdempotencyHeader(request)

// Don't send the current retry count in the headers if the caller set their own value.
Expand All @@ -94,8 +90,12 @@ private constructor(
val requestWithRetryCount =
if (shouldSendRetryCount) setRetryCountHeader(request, retries) else request

return httpClient
.executeAsync(requestWithRetryCount, requestOptions)
val responseFuture = httpClient.executeAsync(requestWithRetryCount, requestOptions)
if (!isRetryable(requestWithRetryCount)) {
return responseFuture
}

return responseFuture
.handleAsync(
fun(
response: HttpResponse?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.onebusaway.core
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.exc.MismatchedInputException
import com.fasterxml.jackson.module.kotlin.readValue
import java.time.LocalDateTime
import java.time.OffsetDateTime
import kotlin.reflect.KClass
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.catchThrowable
Expand Down Expand Up @@ -46,26 +46,14 @@ internal class ObjectMappersTest {
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,
)
}
}
Expand All @@ -84,7 +72,7 @@ internal class ObjectMappersTest {
}
}

enum class LenientLocalDateTimeTestCase(val string: String) {
enum class LenientOffsetDateTimeTestCase(val string: String) {
DATE("1998-04-21"),
DATE_TIME("1998-04-21T04:00:00"),
ZONED_DATE_TIME_1("1998-04-21T04:00:00+03:00"),
Expand All @@ -93,10 +81,10 @@ internal class ObjectMappersTest {

@ParameterizedTest
@EnumSource
fun readLocalDateTime_lenient(testCase: LenientLocalDateTimeTestCase) {
fun readOffsetDateTime_lenient(testCase: LenientOffsetDateTimeTestCase) {
val jsonMapper = jsonMapper()
val json = jsonMapper.writeValueAsString(testCase.string)

assertDoesNotThrow { jsonMapper().readValue<LocalDateTime>(json) }
assertDoesNotThrow { jsonMapper().readValue<OffsetDateTime>(json) }
}
}
2 changes: 1 addition & 1 deletion onebusaway-sdk-java-proguard-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4")
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0")
}

tasks.shadowJar {
Expand Down
Loading