Skip to content

Add Java SDK (draft) - #1

Merged
clarivo-dev merged 3 commits into
mainfrom
feat/sdk-v0
Oct 27, 2026
Merged

clarivo-dev merged 3 commits into
mainfrom
feat/sdk-v0

Conversation

@ernestova

@ernestova ernestova commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

First import of the Java SDK (pre-release 0.1.0-SNAPSHOT, nothing is published to Maven Central or anywhere else).

  • Models generated from the OpenAPI 3.1 spec with OpenAPI Generator (native library, Jackson); scripts/gen_operations.py + mvn -Pgenerate generate-sources; CI fails on drift.
  • Thin hand-written client on java.net.http: retries with Retry-After, one Idempotency-Key per call reused by retries, RFC 9457 typed errors, cursor pagination, warmRuns.waitFor.
  • https-only base URL, no default host, no redirects, the key never appears in toString() or exception messages.

Tested in the maven:3.9-eclipse-temurin-17 image: mvn test, 14 tests.

The Maven groupId com.sitewarm is a placeholder until the namespace is decided. The spec describes the planned API surface; the service may not offer every operation yet.

Ported review findings

Ported from the Go SDK review: a keyed POST retries a 409 conflict (never idempotency-key-reused); certificate verification, unknown-host and malformed-request errors are not retried, other network errors keep the existing rule; Retry-After is floored at the retry base with up to +25% jitter (above the cap it is still thrown); a 2xx body that is not JSON throws SiteWarmException.Decode (status()); the default User-Agent is sitewarm-java/0.1.0-SNAPSHOT (+https://github.com/sitewarm/sdk-java) and userAgent("") keeps it. Tests: LowsTest (35 tests pass in maven:3.9-eclipse-temurin-17, mvn verify).

Deviations: the version is the pom's 0.1.0-SNAPSHOT, kept in a SiteWarm.VERSION constant that a test compares with the pom. An invalid header or URL (which the JDK reports as IllegalArgumentException while building the request) is now a SiteWarmException with a fixed message, never retried. JDK HttpClient reports an unresolvable host as ConnectException caused by UnresolvedAddressException, which is treated as not-found (it cannot tell a temporary DNS failure apart). Decode carries no cause (a parser message can quote the body). The base path already keeps %2F (getRawPath), so only a regression test was added. Ids stay opaque; key validation and error sentinels are out of scope.

🤖 Generated with Claude Code

ernestova and others added 3 commits October 27, 2026 00:04
…y-After floor, decode error, User-Agent

- Retry a 409 conflict on keyed POSTs only; never idempotency-key-reused.
- Do not retry certificate, unknown-host or malformed-request errors.
- Retry-After floor at the retry base, with jitter; longer than the cap is surfaced.
- Typed decode error (with status) for a 2xx body that is not JSON.
- User-Agent carries version and URL; an empty custom one keeps the default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4ijWAJZzDChcsSYmgTYcD
@clarivo-dev
clarivo-dev marked this pull request as ready for review October 27, 2026 20:01
@clarivo-dev
clarivo-dev merged commit 3b92206 into main Oct 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants