Skip to content

fix: ESG query-string binding and EntityRisk CountryOfIncorporation casing#1

Merged
aagarwal-apexanalytix merged 1 commit into
mainfrom
fix/esg-query-and-coi-casing
May 6, 2026
Merged

fix: ESG query-string binding and EntityRisk CountryOfIncorporation casing#1
aagarwal-apexanalytix merged 1 commit into
mainfrom
fix/esg-query-and-coi-casing

Conversation

@aagarwal-apexanalytix
Copy link
Copy Markdown
Contributor

Summary

Cross-repo audit of all SDK methods against the live QubitOn API surfaced 2 issues in the Java SDK. Same drift surface as the SAP, Oracle, Go, and Node connector PRs:

Fixes (2)

# What Why it was broken Fix
1 `lookupESGScore` / `Esg.ESGRequest` API binds `country` and `domain` as `[FromQuery]` on ESGController, not body. Java SDK was POSTing them in the JSON body — silently dropped on the server, scoring defaulted to global / no-domain Marked `country` and `domain` with `@JsonIgnore` so Jackson omits them from the body. Added an `esgPath` helper that serialises them into the URL query string with `URLEncoder` + `StandardCharsets.UTF_8`
2 `EntityRiskRequest.countryOfIncorporation` (Risk.java) The canonical API DTO pins this property as PascalCase via `[JsonPropertyName("CountryOfIncorporation")]` which overrides the global camelCase naming policy. The server is case-sensitive, so the lowercase camelCase wire name was silently dropped — country was never associated with the request Changed `@JsonProperty("countryOfIncorporation")` → `@JsonProperty("CountryOfIncorporation")`. Added a code comment so a future "casing cleanup" doesn't revert it

Public Java method signatures and getter/setter/builder names are unchanged (`setCountryOfIncorporation`, `.countryOfIncorporation(...)`, `getCountry()`, `getDomain()`, etc.). Only the wire JSON keys change.

Backwards compatibility

  • ESG: existing call sites that don't set country/domain see no behaviour change. Call sites that DO set them now correctly produce `?country=…&domain=…` on the URL instead of being silently dropped.
  • EntityRisk: the prior wire name `countryOfIncorporation` was not being honoured by the server (request was effectively missing the field), so no caller could have been relying on the old behaviour to work.

Audit findings outside this PR

Spot-checked the other drift candidates — all clean:

Type Status
`Tax.TaxRequest` ✅ `identityNumber` / `identityNumberType` / `country` / `entityName`
`Tax.TaxFormatRequest` ✅ `identityNumber` / `identityNumberType` / `countryIso2`
`BusinessRegistration.BusinessRegistrationRequest` ✅ `entityName`

The Java SDK previously had three of the four common drift traps already correct — only the ESG query-binding and the `CountryOfIncorporation` PascalCase override were missed.

Test plan

  • `mvn -B test` passes
  • `@JsonIgnore` on `country`/`domain` excludes them from Jackson body marshal (verified by Esg.java diff)
  • `URLEncoder.encode` handles percent-encoding for special characters
  • Public getter/setter/builder API surface unchanged
  • Smoke test against the dev API: verify `?country=US&domain=acme.com` appears on the wire for ESG, and that `CountryOfIncorporation` (PascalCase) lands on the entity-risk request

Diff

`+40 / -5` across `Esg.java`, `Risk.java`, and `QubitOnClient.java`.

…asing

Cross-repo audit of all SDK methods against the live QubitOn API
surfaced two issues. Same drift surface as the SAP, Oracle, Go, and
Node SDK PRs.

1. lookupESGScore (Esg.ESGRequest)
   country and domain are bound on the server as [FromQuery] on
   ESGController, not body. Java SDK was sending them in the JSON
   body where they were silently dropped, causing scoring to default
   to global / no-domain results.
   Fix: marked the country and domain fields with @JsonIgnore so
   Jackson omits them from the marshalled body, and added an esgPath
   helper that serialises them into the URL query string with
   URLEncoder + StandardCharsets.UTF_8.

2. EntityRiskRequest.countryOfIncorporation (Risk.java)
   The canonical API DTO pins this property as PascalCase via
   [JsonPropertyName("CountryOfIncorporation")] which overrides the
   global camelCase naming policy. The server is case-sensitive here,
   so the lowercase camelCase wire name was silently dropped on
   deserialisation -- the country was never associated with the
   request. Java SDK was tagging the field as
   @JsonProperty("countryOfIncorporation") (camelCase). Changed to
   @JsonProperty("CountryOfIncorporation") (PascalCase) and added a
   comment explaining the trap so a future "consistency cleanup"
   doesn't revert it.

Public Java method signatures and getter/setter names are unchanged
(setter is still setCountryOfIncorporation, builder method is still
.countryOfIncorporation(...)). Only the wire JSON key changes.

Audit findings outside this PR
-------------------------------

Spot-checked the other drift candidates -- all clean:

- TaxRequest: identityNumber/identityNumberType/country/entityName ✅
- TaxFormatRequest: identityNumber/identityNumberType/countryIso2 ✅
- BusinessRegistrationRequest: entityName ✅

Tests
-----

mvn -B test passes (no failures).
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