up
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
oas-ci / oas-validate (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
SDK Publish & Sign / sdk-publish (push) Has been cancelled

This commit is contained in:
master
2025-11-27 15:05:48 +02:00
parent 4831c7fcb0
commit e950474a77
278 changed files with 81498 additions and 672 deletions

View File

@@ -0,0 +1,45 @@
# Java SDK (SDKGEN-63-004)
Deterministic generator settings for the Java SDK with OkHttp client and builder pattern.
## Prereqs
- `STELLA_OAS_FILE` pointing to the frozen OpenAPI spec.
- OpenAPI Generator CLI 7.4.0 jar at `tools/openapi-generator-cli-7.4.0.jar` (override with `STELLA_OPENAPI_GENERATOR_JAR`).
- JDK 21 available on PATH (vendored at `../tools/jdk-21.0.1+12`; set `JAVA_HOME` if needed).
## Generate
```bash
cd src/Sdk/StellaOps.Sdk.Generator
STELLA_OAS_FILE=ts/fixtures/ping.yaml \
STELLA_SDK_OUT=$(mktemp -d) \
java/generate-java.sh
```
Outputs land in `out/java/` and are post-processed to normalize whitespace, inject the banner, and copy shared helpers (`Hooks.java`).
Override `STELLA_SDK_OUT` to keep the repo clean during local runs.
## Design Principles
- **Builder pattern**: API clients follow idiomatic Java builder patterns for configuration.
- **OkHttp abstraction**: Uses OkHttp as the HTTP client with interceptor-based hooks.
- **Jakarta EE**: Uses `jakarta.*` packages for enterprise compatibility.
- **Deterministic**: Generation is reproducible given the same spec and toolchain lock.
## Helpers
The post-process step copies `Hooks.java` into the output directory providing:
- `Hooks.withAll()`: Composes auth, telemetry, and retry interceptors onto an OkHttpClient
- `AuthProvider`: Interface for token-based authentication
- `RetryOptions`: Configurable retry with exponential backoff
- `TelemetryOptions`: Client/trace header injection
- `StellaAuthInterceptor`, `StellaTelemetryInterceptor`, `StellaRetryInterceptor`: OkHttp interceptors
## Maven Coordinates
```xml
<dependency>
<groupId>com.stellaops</groupId>
<artifactId>stellaops-sdk</artifactId>
<version>0.0.0-alpha</version>
</dependency>
```