Commit 3ad9319
committed
fix: bind isBatch on the legacy translate endpoint under Jackson 3
The public legacy endpoint POST /v2/public/translator/translate deserializes into
LegacyTolgeeTranslateRequest, whose `isBatch: Boolean` field silently stopped binding
after the Spring Boot 4 upgrade moved the JSON stack from Jackson 2 to Jackson 3
(tools.jackson). Requests now fail with request_parse_error (HTTP 400):
Missing required creator property 'isBatch' (index 6)
Cause: Kotlin compiles a `val isBatch: Boolean` property to the JVM getter `isBatch()`
(the `is`-prefixed form, not `getIsBatch()`). Jackson derives a property's external JSON
name from its getter and, for an `is`-getter returning boolean, strips the prefix:
`isBatch()` -> external name `batch`. Jackson 2 + jackson-module-kotlin kept the external
name aligned to the Kotlin property name (`isBatch`), so incoming `"isBatch"` bound. Under
Jackson 3 the boolean `is`-getter naming wins, so the field binds to the JSON key `batch`
instead; the incoming `"isBatch"` no longer matches, and because the parameter is non-null
with no default it is reported as a missing required creator property. The implicit name in
the error is still `isBatch` (the constructor parameter name) even though the key Jackson was
actually looking for is `batch`.
Fix:
- @JsonProperty("isBatch") pins the external name back to `isBatch` so real clients (and the
SDK/CLI) that send `"isBatch"` bind correctly again, including `isBatch = true`.
- `= false` default makes the field optional so requests that omit it do not hit
"missing required creator property" regardless of the resolved key name, matching the
pre-upgrade behavior where a missing boolean defaulted to false.
Surfaced by the billing EeTolgeeTranslatorControllerTest suite, which exercises this endpoint.1 parent ac42cfc commit 3ad9319
1 file changed
Lines changed: 3 additions & 1 deletion
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
0 commit comments