fix(event): avoid Jackson 3 type property conflict#1949
Open
guslegend0510 wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
zouyx
approved these changes
Jun 28, 2026
itxaiohanglover
approved these changes
Jun 30, 2026
itxaiohanglover
left a comment
Contributor
There was a problem hiding this comment.
Clean fix. Switching from As.PROPERTY to As.EXISTING_PROPERTY resolves the Jackson conflict between the type-id property and the bean property named type. The test coverage for both serialization (single type property) and deserialization (polymorphic) looks solid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
2.0.0-SNAPSHOT
Description
Closes #1948.
This PR fixes
io.agentscope.core.event.AgentEventserialization failures under Jackson 3, especially when events are streamed through Spring MVCSseEmitter/ResponseBodyEmitter.Root cause
AgentEventused:At the same time, the event hierarchy exposes
getType(). Under Jackson 3 this causes a serializer conflict between the synthetic type-id property and the bean property namedtype, which leads to:InvalidDefinitionException: Conflict between type id property 'type' and bean property with same nameChanges
AgentEventpolymorphic type handling fromJsonTypeInfo.As.PROPERTYtoJsonTypeInfo.As.EXISTING_PROPERTYgetType()contract as the single source of the serializedtypefieldAgentStartEventserialization containing exactly onetypefieldAgentEventbase typeHow to test
Run targeted regression tests:
mvn -pl agentscope-core test -Dtest=AgentEventStreamTestI also ran:
mvn -pl agentscope-core testThe event/Jackson-related tests passed. Two existing Windows-specific symlink permission tests failed in my environment and appear unrelated to this change:
DangerousPathBypassTest.symlinkToDotEnvIsDetectedDangerousPathBypassTest.symlinkToSshIsDetectedChecklist
mvn spotless:applymvn -pl agentscope-core test -Dtest=AgentEventStreamTest)