Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/open-transit-kotlin' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4
Expand All @@ -39,6 +40,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/open-transit-kotlin' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

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.74"
".": "0.1.0-alpha.75"
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.1.0-alpha.75 (2025-07-01)

Full Changelog: [v0.1.0-alpha.74...v0.1.0-alpha.75](https://github.com/OneBusAway/kotlin-sdk/compare/v0.1.0-alpha.74...v0.1.0-alpha.75)

### Bug Fixes

* **client:** don't close client on `withOptions` usage when original is gc'd ([0265af6](https://github.com/OneBusAway/kotlin-sdk/commit/0265af6c25213278c66a6f9efb5fc2b1b5173293))


### Chores

* **ci:** only run for pushes and fork pull requests ([24abc88](https://github.com/OneBusAway/kotlin-sdk/commit/24abc88adc64f2601d0da87b4a96efdca6501ac7))


### Refactors

* **internal:** minor `ClientOptionsTest` change ([409443d](https://github.com/OneBusAway/kotlin-sdk/commit/409443d56416677160f77799b2cce329da135972))

## 0.1.0-alpha.74 (2025-06-27)

Full Changelog: [v0.1.0-alpha.73...v0.1.0-alpha.74](https://github.com/OneBusAway/kotlin-sdk/compare/v0.1.0-alpha.73...v0.1.0-alpha.74)
Expand Down
10 changes: 5 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-kotlin)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.74)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.74/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.74)
[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-kotlin)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.75)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.75/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.75)

<!-- 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). KDocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.74).
The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). KDocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-kotlin/0.1.0-alpha.75).

<!-- 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-kotlin:0.1.0-alpha.74")
implementation("org.onebusaway:onebusaway-sdk-kotlin:0.1.0-alpha.75")
```

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

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.74" // x-release-please-version
version = "0.1.0-alpha.75" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ private constructor(
apiKey = clientOptions.apiKey
}

fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
fun httpClient(httpClient: HttpClient) = apply {
this.httpClient = PhantomReachableClosingHttpClient(httpClient)
}

fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply {
this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility
Expand Down Expand Up @@ -226,13 +228,11 @@ private constructor(

return ClientOptions(
httpClient,
PhantomReachableClosingHttpClient(
RetryingHttpClient.builder()
.httpClient(httpClient)
.clock(clock)
.maxRetries(maxRetries)
.build()
),
RetryingHttpClient.builder()
.httpClient(httpClient)
.clock(clock)
.maxRetries(maxRetries)
.build(),
checkJacksonVersionCompatibility,
jsonMapper,
clock,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// File generated from our OpenAPI spec by Stainless.

package org.onebusaway.core

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.mockito.junit.jupiter.MockitoExtension
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.verify
import org.onebusaway.core.http.HttpClient

@ExtendWith(MockitoExtension::class)
internal class ClientOptionsTest {

private val httpClient = mock<HttpClient>()

@Test
fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() {
var clientOptions =
ClientOptions.builder().httpClient(httpClient).apiKey("My API Key").build()
verify(httpClient, never()).close()

// Overwrite the `clientOptions` variable so that the original `ClientOptions` is GC'd.
clientOptions = clientOptions.toBuilder().build()
System.gc()
Thread.sleep(100)

verify(httpClient, never()).close()
// This exists so that `clientOptions` is still reachable.
assertThat(clientOptions).isEqualTo(clientOptions)
}
}