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
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:
35
src/Sdk/StellaOps.Sdk.Generator/go/README.md
Normal file
35
src/Sdk/StellaOps.Sdk.Generator/go/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Go SDK (SDKGEN-63-003)
|
||||
|
||||
Deterministic generator settings for the Go SDK with context-first API design.
|
||||
|
||||
## 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) \
|
||||
go/generate-go.sh
|
||||
```
|
||||
|
||||
Outputs land in `out/go/` and are post-processed to normalize whitespace, inject the banner, and copy shared helpers (`hooks.go`).
|
||||
Override `STELLA_SDK_OUT` to keep the repo clean during local runs.
|
||||
|
||||
## Design Principles
|
||||
|
||||
- **Context-first**: All API methods accept `context.Context` as the first parameter for cancellation and deadline propagation.
|
||||
- **Interfaces**: Generated interfaces allow easy mocking in tests.
|
||||
- **RoundTripper hooks**: Auth, retry, and telemetry are implemented as composable `http.RoundTripper` wrappers via `hooks.go`.
|
||||
- **Deterministic**: Generation is reproducible given the same spec and toolchain lock.
|
||||
|
||||
## Helpers
|
||||
|
||||
The post-process step copies `hooks.go` into the output directory providing:
|
||||
- `AuthRoundTripper`: Injects Authorization header from token provider
|
||||
- `RetryRoundTripper`: Retries transient errors with exponential backoff
|
||||
- `TelemetryRoundTripper`: Adds client/trace headers
|
||||
- `WithClientHooks`: Composes round-trippers onto an `*http.Client`
|
||||
- `Paginate[T]`: Generic cursor-based pagination helper
|
||||
Reference in New Issue
Block a user