Update SDK (Java)
Goal
Regenerate SDK code in src/src/main/java/com/relewise/client from Generator, validate the result, and deliver a reviewed PR to main.
Required Input
Require a Trello card URL before running SDK update work.
If the request does not include a Trello URL:
- •Ask for it.
- •Do not continue until it is provided.
Preflight Git Safety
Run from repository root.
- •Require a clean worktree:
git status --porcelain
Abort when any output exists.
- •Ensure
originexists:
git remote get-url origin
Abort on failure.
- •Fetch refs:
git fetch origin --prune
Abort on failure.
- •Switch to
main:
git switch main
Abort if switch is not safe.
- •Fast-forward
main:
git pull --ff-only origin main
Abort if not fast-forward.
Do not continue when any preflight step fails.
Branch Creation
Use a timestamped branch:
$stamp = Get-Date -Format 'yyyyMMdd-HHmm' $branchName = "chore/update-sdk-$stamp"
Abort if branch exists:
git show-ref --verify --quiet "refs/heads/$branchName" git ls-remote --exit-code --heads origin $branchName
Create and switch:
git switch -c $branchName
SDK Regeneration
Regenerate SDK code:
./generate.ps1
Alternative on non-Windows:
./generate.sh
Expected Changes Check
Inspect changed files and ensure the update is coherent.
Expected change locations:
- •
src/src/main/java/com/relewise/client/model/*generated model files - •generated client surfaces in
src/src/main/java/com/relewise/client/* - •generator changes only when intentionally included
If unrelated files changed unexpectedly, stop and investigate.
Validation (Required)
Run from repository root:
- •Package:
mvn --batch-mode -DskipTests package --file src/pom.xml
- •Resource/version metadata:
mvn resources:resources --file src/pom.xml
- •Tests:
mvn --batch-mode test --file src/pom.xml
Integration-heavy tests depend on DATASET_ID and API_KEY.
When credentials are unavailable, run a credential-independent subset and report integration-heavy coverage as not run:
mvn --batch-mode -Dtest=ClientConstructionTest,DateTimeSerializationTest test --file src/pom.xml
Acceptance Criteria
Treat update as successful only when:
- •generation succeeds (
generate.ps1orgenerate.sh) - •package/resources commands succeed
- •test command(s) pass for available credentials
- •changed files are expected and reviewable
Commit, Push, and Pull Request
- •Commit SDK update changes:
git add . git commit -m "chore(java): update sdk generation ($stamp)"
- •Push branch:
git push -u origin $branchName
- •Create PR to
main.
Preferred flow with GitHub CLI:
$prBodyPath = ".\\update-sdk-pr-body.md"
$prBodyTemplate = @'
__TRELLO_CARD_URL__
## Summary
- Regenerated Java SDK code via Generator
- Updated generated models/client surfaces
## Validation
- `./generate.ps1`: <result>
- `mvn --batch-mode -DskipTests package --file src/pom.xml`: <result>
- `mvn resources:resources --file src/pom.xml`: <result>
- `mvn --batch-mode test --file src/pom.xml`: <result or not run>
- `mvn --batch-mode -Dtest=ClientConstructionTest,DateTimeSerializationTest test --file src/pom.xml`: <result or not run>
## Notes
- <known issues or limitations>
'@
$prBody = $prBodyTemplate -replace '__TRELLO_CARD_URL__', $TrelloCardUrl
Set-Content -Path $prBodyPath -Value $prBody -Encoding utf8
$prUrl = gh pr create --base main --head $branchName --title "chore(java): update sdk generation ($stamp)" --body-file $prBodyPath
if ($LASTEXITCODE -ne 0) { throw 'gh pr create failed.' }
Write-Host "PR URL: $prUrl"
Manual fallback:
git push -u origin $branchName Write-Host "Create PR: https://github.com/Relewise/relewise-sdk-java/compare/main...$branchName?expand=1" Write-Host "PR title: chore(java): update sdk generation ($stamp)" Write-Host "PR body file: $prBodyPath"
Keep the Trello URL as the first line of the PR description. Write the PR body file as UTF-8 to avoid symbol corruption in GitHub-rendered text.
Output Expectations
Provide a final summary with:
- •Trello URL used
- •branch name
- •changed file groups
- •validation command results
- •pushed branch URL
- •PR URL, or exact manual fallback instructions