weiqingy commented on code in PR #1046:
URL: https://github.com/apache/flink-agents/pull/1046#discussion_r3888556723
##########
api/src/main/java/org/apache/flink/agents/api/agents/ReActAgent.java:
##########
@@ -69,11 +70,28 @@ public ReActAgent(
jsonSchema = outputSchema.toString();
outputSchema = new OutputSchema((RowTypeInfo) outputSchema);
} else if (outputSchema instanceof Class) {
+ Class<?> schemaClass = (Class<?>) outputSchema;
+ JsonNode schemaNode;
try {
- jsonSchema = mapper.generateJsonSchema((Class<?>)
outputSchema).toString();
- } catch (JsonMappingException e) {
- throw new RuntimeException(e);
+ schemaNode =
mapper.generateJsonSchema(schemaClass).getSchemaNode();
+ } catch (JsonMappingException | IllegalArgumentException e) {
Review Comment:
Thanks for the review!
Done. Turned out it isn't only direct self-reference: a mutual cycle, `A`
holding a `B` that holds an `A`, blows the stack the same way. So the message
talks about the schema referring back to itself rather than naming the direct
case.
I gave it its own catch clause rather than adding to the existing one, since
`StackOverflowError` carries no message and folding it in would have printed
`reported: null`.
--
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]