weiqingy opened a new issue, #1254:
URL: https://github.com/apache/flink-agents/issues/1254

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   After #1247, every Java provider builds its native schema with 
`PojoJsonSchemaGenerator`, which lists the values Jackson reads for an enum. 
That holds only when every constant has `@JsonProperty`. victools flattens the 
enum only in that case. With `@JsonProperty` on some constants, the schema 
lists the Java names for all of them. The model follows the schema, and the 
reply then fails to parse with `InvalidFormatException`. This affects all 7 
Java providers.
   
   A numeric `@JsonValue` has a related problem: the schema becomes 
`{"type":"string","enum":[1,-1]}`, which contradicts itself.
   
   Proposed fix: a custom enum definition in `PojoJsonSchemaGenerator` that 
lists each constant's Jackson-serialized value and the matching JSON type. Then 
a partly annotated enum and a numeric `@JsonValue` both work. The structured 
output guide (#1252) documents both limits for now, and the generator's class 
comment already notes the first one.
   
   ### How to reproduce
   
   ```java
   public enum Status {
       @JsonProperty("in-progress") IN_PROGRESS,
       DONE
   }
   ```
   
   - The schema lists `["IN_PROGRESS","DONE"]`.
   - Jackson reads `"in-progress"` and `"DONE"`.
   - So a reply with `"IN_PROGRESS"` throws `InvalidFormatException`.
   
   ### Version and environment
   
   main at dda10f62, `integrations/chat-models/common`.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


-- 
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