Skip to content

fix(core): use @JsonProperty on Event.isLast() to preserve JSON key#1052

Open
LearningGp wants to merge 1 commit intoagentscope-ai:mainfrom
LearningGp:fix-last
Open

fix(core): use @JsonProperty on Event.isLast() to preserve JSON key#1052
LearningGp wants to merge 1 commit intoagentscope-ai:mainfrom
LearningGp:fix-last

Conversation

@LearningGp
Copy link
Copy Markdown
Collaborator

AgentScope-Java Version

1.0.10

Description

fix(core): use @JsonProperty on Event.isLast() to preserve JSON key

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Jackson JSON serialization of Event.isLast so the emitted JSON key remains isLast (instead of being normalized to last via JavaBeans boolean getter conventions), keeping serialization consistent with existing constructor-based deserialization.

Changes:

  • Annotate Event.isLast() with @JsonProperty("isLast") to force the JSON property name during serialization.
  • Add a regression test verifying JSON output contains "isLast" (and not "last") and that round-trip deserialization preserves the value.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
agentscope-core/src/main/java/io/agentscope/core/agent/Event.java Adds @JsonProperty("isLast") to the boolean getter to preserve the intended JSON key on serialization.
agentscope-core/src/test/java/io/agentscope/core/agent/EventTest.java Adds a regression test covering the JSON key name and round-trip behavior for isLast.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@chickenlj chickenlj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

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.

3 participants