Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b98923e
feat(javav2): per-operation timeouts and bounded response body reads
AshGodfrey Oct 30, 2026
d982d74
feat(java): keep legacy operation constructors, exempt streams from t…
AshGodfrey Oct 30, 2026
668f54c
fix(java): skip the timeout option on name collisions and tighten OkH…
AshGodfrey Oct 30, 2026
b5cdedb
chore: regenerate templates/perms.go with the go.mod toolchain
AshGodfrey Oct 30, 2026
6c047d7
fix(java): decide the body-cap exemption from the request and apply t…
AshGodfrey Oct 30, 2026
f289209
fix(java): honour q=0 Accept ranges for the body cap, restore seconda…
AshGodfrey Oct 30, 2026
2cb8fc0
fix(java): keep empty leading media type when splitting Content-Type
AshGodfrey Nov 3, 2026
dff2d90
Merge remote-tracking branch 'origin/main' into ash/javav2-timeouts-b…
AshGodfrey Nov 3, 2026
a99f35f
docs(java): trim timeout and response body cap comments
AshGodfrey Nov 3, 2026
be92bd7
fix(java): keep streams alive under the OkHttp call timeout, verify t…
AshGodfrey Nov 3, 2026
6ecc938
fix(java): bound OkHttp stream header waits and keep connect timeouts…
AshGodfrey Nov 3, 2026
1141918
fix(java): bound the whole call with the request timeout on both clie…
AshGodfrey Nov 3, 2026
12f29e0
fix(java): start the async body deadline when the response arrives
AshGodfrey Nov 3, 2026
e20741a
fix(java): deliver onSubscribe downstream before the async body deadl…
AshGodfrey Nov 4, 2026
9e6a722
fix(java): let an early body deadline cancel the upstream before onSu…
AshGodfrey Nov 4, 2026
765f2d2
fix(java): keep async overloads, cap only streamed responses, surface…
AshGodfrey Nov 4, 2026
f53105e
feat(java): gate x-speakeasy-timeout behind enforceOperationTimeout
AshGodfrey Nov 4, 2026
07f7cb7
fix(java): deliver async body timeouts off the shared deadline thread
AshGodfrey Nov 5, 2026
bc6cf2c
refactor(java): remove the response body cap
AshGodfrey Nov 5, 2026
543084e
refactor(java): keep response body buffering for logging unchanged
AshGodfrey Nov 5, 2026
0c7f7a6
refactor(java): keep the JDK HTTP client connect timeout unchanged
AshGodfrey Nov 6, 2026
062af9a
Merge remote-tracking branch 'origin/main' into ash/javav2-timeouts-b…
AshGodfrey Nov 16, 2026
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
10 changes: 10 additions & 0 deletions .changesets/1793357308-562eaa46.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
id: 1793357308-562eaa46
features:
- operationTimeout
targets:
- javav2
type: feat
bump: minor
description: add an SDK-wide and per-call timeout that bounds the whole call including the response body and streams, on both HTTP clients, and honour x-speakeasy-timeout behind the enforceOperationTimeout option, which is on for new SDKs and off for existing ones
author: AshGodfrey
date: "2026-10-30"
15 changes: 13 additions & 2 deletions pkg/generate/snapshots/java8_raw_pagination_unwrap_java_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ import java.io.InputStream;
import java.lang.Iterable;
import java.lang.Long;
import java.lang.String;
import java.time.Duration;
import java.util.Collection;
import java.util.Iterator;
import java.util.stream.Stream;
import org.openapis.openapi.SDKConfiguration;
import org.openapis.openapi.operations.ListItems;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Java8Compat;
import org.openapis.openapi.utils.Options;
import org.openapis.openapi.utils.Utils;
import org.openapis.openapi.utils.pagination.CursorTracker;
import org.openapis.openapi.utils.pagination.Paginator;
Expand All @@ -120,11 +122,13 @@ public class ListItemsRequestBuilder {
private final Headers _headers = new Headers();
private final ListItemsRequest.Builder pojoBuilder;
private ListItemsRequest request;
private final Options.Builder optionsBuilder;
private boolean _setterCalled;

public ListItemsRequestBuilder(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.pojoBuilder = ListItemsRequest.builder();
this.optionsBuilder = Options.builder();
}

public ListItemsRequestBuilder cursor(@Nullable String cursor) {
Expand All @@ -139,6 +143,11 @@ public class ListItemsRequestBuilder {
return this;
}

public ListItemsRequestBuilder timeout(Duration timeout) {
this.optionsBuilder.timeout(timeout);
return this;
}

private ListItemsRequest _buildRequest() {
if (this._setterCalled) {
this.request = this.pojoBuilder.build();
Expand All @@ -159,8 +168,9 @@ public class ListItemsRequestBuilder {
* @return The response from the server.
*/
public ListItemsResponse call() {
Options options = optionsBuilder.build();
RequestOperation<ListItemsRequest, ListItemsResponse> operation
= new ListItems.Sync(sdkConfiguration, _headers);
= new ListItems.Sync(sdkConfiguration, options, _headers);
return operation.handleResponse(operation.doRequest(this._buildRequest()));
}

Expand All @@ -179,8 +189,9 @@ public class ListItemsRequestBuilder {
*/
public Iterable<ListItemsResponse> callAsIterable() {
ListItemsRequest request = pojoBuilder.build();
Options options = optionsBuilder.build();
RequestOperation<ListItemsRequest, ListItemsResponse> operation
= new ListItems.Sync(sdkConfiguration, _headers);
= new ListItems.Sync(sdkConfiguration, options, _headers);

Iterator<HttpResponse<InputStream>> iterator = new Paginator<>(
request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ package org.openapis.openapi;

import static org.openapis.openapi.operations.Operations.AsyncRequestlessOperation;

import jakarta.annotation.Nullable;
import java.util.concurrent.CompletableFuture;
import org.openapis.openapi.models.operations.async.GetFederationStatusRequestBuilder;
import org.openapis.openapi.models.operations.async.GetFederationStatusResponse;
import org.openapis.openapi.operations.GetFederationStatus;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Options;


public class AsyncFederation {
Expand Down Expand Up @@ -142,13 +144,23 @@ public class AsyncFederation {
}

/**
* Makes an async request
* Makes an async request(required parameters only).
*
* @return {@code CompletableFuture<GetFederationStatusResponse>} - The async response
*/
public CompletableFuture<GetFederationStatusResponse> getFederationStatusDirect() {
return getFederationStatus(null);
}

/**
* Makes an async request
*
* @param options additional options
* @return {@code CompletableFuture<GetFederationStatusResponse>} - The async response
*/
public CompletableFuture<GetFederationStatusResponse> getFederationStatus(@Nullable Options options) {
AsyncRequestlessOperation<GetFederationStatusResponse> operation
= new GetFederationStatus.Async(sdkConfiguration, _headers);
= new GetFederationStatus.Async(sdkConfiguration, options, _headers);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
Expand All @@ -166,10 +178,12 @@ package org.openapis.openapi;

import static org.openapis.openapi.operations.Operations.RequestlessOperation;

import jakarta.annotation.Nullable;
import org.openapis.openapi.models.operations.GetFederationStatusRequestBuilder;
import org.openapis.openapi.models.operations.GetFederationStatusResponse;
import org.openapis.openapi.operations.GetFederationStatus;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Options;


public class Federation {
Expand Down Expand Up @@ -213,14 +227,25 @@ public class Federation {
}

/**
* Makes a request.
* Makes a request (required parameters only).
*
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public GetFederationStatusResponse getFederationStatusDirect() {
return getFederationStatus(null);
}

/**
* Makes a request.
*
* @param options additional options
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public GetFederationStatusResponse getFederationStatus(@Nullable Options options) {
RequestlessOperation<GetFederationStatusResponse> operation
= new GetFederationStatus.Sync(sdkConfiguration, _headers);
= new GetFederationStatus.Sync(sdkConfiguration, options, _headers);
return operation.handleResponse(operation.doRequest());
}

Expand Down Expand Up @@ -264,11 +289,13 @@ package org.openapis.openapi;

import static org.openapis.openapi.operations.Operations.AsyncRequestlessOperation;

import jakarta.annotation.Nullable;
import java.util.concurrent.CompletableFuture;
import org.openapis.openapi.models.operations.async.GetFederationStatusRequestBuilder;
import org.openapis.openapi.models.operations.async.GetFederationStatusResponse;
import org.openapis.openapi.operations.GetFederationStatus;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Options;


public class AsyncFederation {
Expand Down Expand Up @@ -313,13 +340,23 @@ public class AsyncFederation {
}

/**
* Makes an async request
* Makes an async request(required parameters only).
*
* @return {@code CompletableFuture<GetFederationStatusResponse>} - The async response
*/
public CompletableFuture<GetFederationStatusResponse> getFederationStatusDirect() {
return getFederationStatus(null);
}

/**
* Makes an async request
*
* @param options additional options
* @return {@code CompletableFuture<GetFederationStatusResponse>} - The async response
*/
public CompletableFuture<GetFederationStatusResponse> getFederationStatus(@Nullable Options options) {
AsyncRequestlessOperation<GetFederationStatusResponse> operation
= new GetFederationStatus.Async(sdkConfiguration, _headers);
= new GetFederationStatus.Async(sdkConfiguration, options, _headers);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
Expand All @@ -337,10 +374,12 @@ package org.openapis.openapi;

import static org.openapis.openapi.operations.Operations.RequestlessOperation;

import jakarta.annotation.Nullable;
import org.openapis.openapi.models.operations.GetFederationStatusRequestBuilder;
import org.openapis.openapi.models.operations.GetFederationStatusResponse;
import org.openapis.openapi.operations.GetFederationStatus;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Options;


public class Federation {
Expand Down Expand Up @@ -384,14 +423,25 @@ public class Federation {
}

/**
* Makes a request.
* Makes a request (required parameters only).
*
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public GetFederationStatusResponse getFederationStatusDirect() {
return getFederationStatus(null);
}

/**
* Makes a request.
*
* @param options additional options
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public GetFederationStatusResponse getFederationStatus(@Nullable Options options) {
RequestlessOperation<GetFederationStatusResponse> operation
= new GetFederationStatus.Sync(sdkConfiguration, _headers);
= new GetFederationStatus.Sync(sdkConfiguration, options, _headers);
return operation.handleResponse(operation.doRequest());
}

Expand Down Expand Up @@ -478,11 +528,13 @@ package org.openapis.openapi;

import static org.openapis.openapi.operations.Operations.AsyncRequestlessOperation;

import jakarta.annotation.Nullable;
import java.util.concurrent.CompletableFuture;
import org.openapis.openapi.models.operations.async.GetFederationStatusRequestBuilder;
import org.openapis.openapi.models.operations.async.GetFederationStatusResponse;
import org.openapis.openapi.operations.GetFederationStatus;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Options;


public class AsyncFederation {
Expand Down Expand Up @@ -521,13 +573,23 @@ public class AsyncFederation {
}

/**
* Makes an async request
* Makes an async request(required parameters only).
*
* @return {@code CompletableFuture<GetFederationStatusResponse>} - The async response
*/
public CompletableFuture<GetFederationStatusResponse> getFederationStatusDirect() {
return getFederationStatus(null);
}

/**
* Makes an async request
*
* @param options additional options
* @return {@code CompletableFuture<GetFederationStatusResponse>} - The async response
*/
public CompletableFuture<GetFederationStatusResponse> getFederationStatus(@Nullable Options options) {
AsyncRequestlessOperation<GetFederationStatusResponse> operation
= new GetFederationStatus.Async(sdkConfiguration, _headers);
= new GetFederationStatus.Async(sdkConfiguration, options, _headers);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
Expand All @@ -545,10 +607,12 @@ package org.openapis.openapi;

import static org.openapis.openapi.operations.Operations.RequestlessOperation;

import jakarta.annotation.Nullable;
import org.openapis.openapi.models.operations.GetFederationStatusRequestBuilder;
import org.openapis.openapi.models.operations.GetFederationStatusResponse;
import org.openapis.openapi.operations.GetFederationStatus;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Options;


public class Federation {
Expand Down Expand Up @@ -586,14 +650,25 @@ public class Federation {
}

/**
* Makes a request.
* Makes a request (required parameters only).
*
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public GetFederationStatusResponse getFederationStatusDirect() {
return getFederationStatus(null);
}

/**
* Makes a request.
*
* @param options additional options
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public GetFederationStatusResponse getFederationStatus(@Nullable Options options) {
RequestlessOperation<GetFederationStatusResponse> operation
= new GetFederationStatus.Sync(sdkConfiguration, _headers);
= new GetFederationStatus.Sync(sdkConfiguration, options, _headers);
return operation.handleResponse(operation.doRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ package org.openapis.openapi;

import static org.openapis.openapi.operations.Operations.RequestlessOperation;

import jakarta.annotation.Nullable;
import org.openapis.openapi.models.operations.CreatePetRequestBuilder;
import org.openapis.openapi.models.operations.CreatePetResponse;
import org.openapis.openapi.operations.CreatePet;
import org.openapis.openapi.utils.Headers;
import org.openapis.openapi.utils.Options;


public class Pet {
Expand Down Expand Up @@ -64,14 +66,25 @@ public class Pet {
}

/**
* Makes a request.
* Makes a request (required parameters only).
*
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public CreatePetResponse createPetDirect() {
return createPet(null);
}

/**
* Makes a request.
*
* @param options additional options
* @return The response from the API call
* @throws RuntimeException subclass if the API call fails
*/
public CreatePetResponse createPet(@Nullable Options options) {
RequestlessOperation<CreatePetResponse> operation
= new CreatePet.Sync(sdkConfiguration, _headers);
= new CreatePet.Sync(sdkConfiguration, options, _headers);
return operation.handleResponse(operation.doRequest());
}

Expand Down
Loading
Loading