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
Export Center CI / export-ci (push) Has been cancelled
Symbols Server CI / symbols-smoke (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
2.7 KiB
2.7 KiB
Post-process Scaffold (SDKGEN-62-002)
These hooks are invoked via OpenAPI Generator's --enable-post-process-file option. They stay deterministic and offline-friendly:
- Normalise line endings to LF and strip trailing whitespace.
- Preserve file mode 0644.
- Inject a deterministic banner for supported languages (TS/JS/Go/Java/C#/Python/Ruby) when enabled (default on).
- Copy shared SDK helpers (auth, retries, pagination, telemetry) per language into the generated output when
STELLA_POSTPROCESS_ROOTandSTELLA_POSTPROCESS_LANGare provided. TypeScript/Python exports are auto-wired so helpers are available from the package barrel.
Usage
Set the generator's post-process command to this script (example for Bash):
export STELLA_SDK_POSTPROCESS="$PWD/postprocess/postprocess.sh"
export JAVA_OPTS="${JAVA_OPTS} -Dorg.openapitools.codegen.utils.postProcessFile=$STELLA_SDK_POSTPROCESS"
Or pass via CLI where supported:
--global-property "postProcessFile=$PWD/postprocess/postprocess.sh"
To copy shared helpers during post-processing, also set the generation root and language:
export STELLA_POSTPROCESS_ROOT="/path/to/generated/sdk"
export STELLA_POSTPROCESS_LANG="ts" # ts|python|go|java|csharp|ruby
Determinism
- Uses only POSIX tools (
sed,perl) available in build containers. - Does not reorder content; only whitespace/line-ending normalization.
- Safe to run multiple times (idempotent).
Configuration (optional)
STELLA_POSTPROCESS_ADD_BANNER(default1): injectsGenerated by StellaOps SDK generator — do not edit.at the top of supported source files, idempotently.STELLA_POSTPROCESS_ROOT: root directory of the generated SDK; required to copy helper files.STELLA_POSTPROCESS_LANG: one ofts|python|go|java|csharp|ruby; controls which helper set is copied.
Helper contents (per language)
- TypeScript (
templates/typescript/sdk-hooks.ts,sdk-error.ts, package/tsconfig templates, README): fetch composers for auth, retries, telemetry headers, paginator, and a minimal typed error class. Packaging files provide ESM/CJS outputs with deterministic settings. - Python (
templates/python/sdk_hooks.py): transport-agnostic wrappers for auth, retries, telemetry headers, and cursor pagination. - Go (
templates/go/hooks.go): http.RoundTripper helpers for auth, telemetry, retries, and a generic paginator. - Java (
templates/java/Hooks.java): OkHttp interceptors for auth, telemetry, retries, plus a helper to compose them. - C#/Ruby templates are reserved for follow-on language tracks; the banner logic already supports them.
Next steps
- Add C#/Ruby helpers once those language tracks start.
- Wire postprocess tests into CI to enforce clean, deterministic outputs.