weiqingy opened a new pull request, #1120:
URL: https://github.com/apache/flink-agents/pull/1120

   Linked issue: #280
   
   ### Purpose of change
   
   A Java output schema whose enum is mapped by `@JsonProperty` or by a 
`@JsonValue` method now lists the values Jackson reads, so a watsonx.ai reply 
that satisfies the schema also deserializes. The connection used a bare 
victools `JacksonModule`, which lists enum constants by their Java names 
(`IN_PROGRESS`) while a caller's `ObjectMapper` only accepts the mapped value 
(`in-progress`). pydantic already lists enum values on the Python side, so the 
two languages also sent different documents for the same type.
   
   The fix enables `FLATTENED_ENUMS_FROM_JSONPROPERTY` and 
`FLATTENED_ENUMS_FROM_JSONVALUE`, the same configuration the Bedrock and Gemini 
connections use. These options only register victools' enum definition 
provider, so property names, property order and the required set stay as they 
were. Only the listed enum values change.
   
   ### Tests
   
   `derivedSchemaFollowsJacksonEnumValues` derives the schema through the 
connection's payload path for a fixture with one `@JsonProperty` enum and one 
`@JsonValue` enum, and reads every listed value back with a plain 
`ObjectMapper`. Removing either option makes it fail. The watsonx module runs 
49 tests with 0 failures and 2 skipped, the skipped ones being the 
credential-gated live tests.
   
   Not verified: no live watsonx.ai call was made.
   
   Two enum shapes are still not handled, the same as in Bedrock and Gemini. An 
enum that maps only some of its constants with `@JsonProperty` is listed by 
Java names for all of them, so an annotated constant fails to read back. An 
enum whose `@JsonValue` returns a number is listed as `"type": "string"` with 
numeric values, which no reply can satisfy; before this change it was listed by 
Java names, which failed to read back instead.
   
   ### API
   
   No public API change.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   
   The enum annotation guidance belongs in the structured output docs that will 
cover every provider.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Claude Code 2.1.272 (Claude Opus 5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to