Skip to content

Generate SDK from OpenAPI, GET integration tests, trim stub examples & generator#45

Open
nmorgan-cb wants to merge 8 commits intomainfrom
nm/generate-endpoints
Open

Generate SDK from OpenAPI, GET integration tests, trim stub examples & generator#45
nmorgan-cb wants to merge 8 commits intomainfrom
nm/generate-endpoints

Conversation

@nmorgan-cb
Copy link
Copy Markdown
Contributor

@nmorgan-cb nmorgan-cb commented Apr 28, 2026

Summary

Regenerates the Prime Java SDK from the published OpenAPI spec (models, per-operation *Request/*Response, *Service/*ServiceImpl, PrimeServiceFactory). Adds Failsafe integration coverage for GET endpoints, serialization/deserialization unit tests for all service domains, and removes placeholder noise from examples and the generator.

The majority of changes in this PR are test files.

SDK generation

  • Client surface and factory aligned with the latest spec (see CHANGELOG.md).

Serialization/deserialization tests (*SerializationTest.java)

  • Added 19 new test files covering all previously untested service domains: Activities, AddressBook, AdvancedTransfers, Allocations, Assets, Balances, Commission, Financing, Futures, Invoice, OnchainAddressBook, PaymentMethods, Portfolios, Positions, Products, Staking, Transactions, Users, Wallets.
  • Each test validates request construction, builder validation (required field checks), request serialization (including @JsonIgnore path param behavior), and response deserialization via ObjectMapper.
  • ObjectMapper configured with FAIL_ON_UNKNOWN_PROPERTIES=false to match production SDK behavior.

Integration tests (*IT.java)

  • BaseIntegrationTest plus per-domain IT classes; optional query parameters exercised where applicable.
  • Set COINBASE_PRIME_CREDENTIALS, COINBASE_PRIME_PORTFOLIO_ID, COINBASE_PRIME_ENTITY_ID for live runs; tests skip when unset.
  • Some cases skip when the account lacks product features (margin/locates, staking currency support, etc.). Allocations GET ITs remain deferred.

Run unit tests:

mvn test

Run ITs:

mvn test-compile failsafe:integration-test
# or:
mvn verify -Dgpg.skip=true

Examples & generator

  • Deleted stub mains under com.coinbase.examples that only printed TODO: implement example for … (no SDK usage).
  • Removed ExamplePhase from tools/model-generator; the generator no longer creates TODO example files. Samples under com.coinbase.examples are documented as hand-maintained only (README.md, CLAUDE.md, tools/model-generator/README.md).

Add BaseIntegrationTest and domain IT classes covering Prime REST GET
operations with optional query parameters where applicable. Tests skip when
COINBASE_PRIME_* env vars are absent or when an endpoint requires features the
account does not have (financing locates, staking currency support).

Run with: mvn test-compile failsafe:integration-test or mvn verify -Dgpg.skip=true.

Made-with: Cursor
@nmorgan-cb nmorgan-cb force-pushed the nm/generate-endpoints branch from f4b5c47 to e7170f6 Compare April 28, 2026 20:05
@nmorgan-cb nmorgan-cb changed the title test: integration coverage for GET endpoints Generate endpoints + integration tests for GET coverage Apr 28, 2026
…ders

Delete generated sample mains that contained only System.out.println stubs with no SDK usage. Keeps existing fuller Example/*.java samples intact.

Made-with: Cursor
Remove ExamplePhase from SdkGeneratorMain; delete the phase class. Docs now state that com.coinbase.examples is hand-maintained only.

Made-with: Cursor
@nmorgan-cb nmorgan-cb changed the title Generate endpoints + integration tests for GET coverage Generate SDK from OpenAPI, GET integration tests, trim stub examples & generator Apr 28, 2026
Reverts all changes to src/main/java/com/coinbase/examples/ introduced
on nm/generate-endpoints, restoring the 3 deleted example files.

Made-with: Cursor
Generator now resolves the SDK-emitted copyright year from the first git
commit that added the anchor file (RequestPhase.java) and preserves the
existing on-disk year for already-tracked files via applyCopyrightYear.
Restores headers on pre-existing files that prior runs had bumped, and
sets new files to the anchor year (2026).

Made-with: Cursor
@nmorgan-cb nmorgan-cb requested review from cfluke-cb and rcbgr April 28, 2026 21:24
…points

Adds comprehensive serialization/deserialization test coverage for all
19 service packages that previously had no tests. Each test file validates
request construction, builder validation, request serialization (including
@JsonIgnore behavior for path params), and response deserialization using
Jackson ObjectMapper configured to match production SDK behavior.

Made-with: Cursor
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.

1 participant