-
Notifications
You must be signed in to change notification settings - Fork 52
Fix: Ensure EntityConverter delegates to AIEntityConverter #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Ensure EntityConverter delegates to AIEntityConverter #303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the JSON serialization behavior to honor JsonIgnore and JsonPropertyName attributes by adding caching for reflection lookups and updating the property mapping logic. Key changes include:
- Introducing GetCachedProperties and GetPropertyMap in ConnectorConverter to improve performance and respect JSON attributes.
- Updating tests to validate derived types, proper handling of ignored properties, and thread safety.
- Enabling JsonPropertyName attributes on AIEntity properties and removing redundant manual property handling in AIEntityConverter.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/tests/Microsoft.Agents.Model.Tests/ObjectSerializationTests.cs | Added tests for derived entity serialization, thread safety, and validation using new attributes. |
src/libraries/Core/Microsoft.Agents.Core/Serialization/Converters/ConnectorConverter.cs | Introduced property caching and mapping to respect JsonIgnore and JsonPropertyName. |
src/libraries/Core/Microsoft.Agents.Core/Serialization/Converters/AIEntityConverter.cs | Removed manual extension data handling to rely on attribute-based mapping via the base. |
src/libraries/Core/Microsoft.Agents.Core/Models/AIEntity.cs | Uncommented and activated JsonPropertyName attributes for correct JSON property naming. |
src/libraries/Core/Microsoft.Agents.Core/Serialization/Converters/ConnectorConverter.cs
Outdated
Show resolved
Hide resolved
fb0a80e
to
6349bfd
Compare
Does #305 replace this PR? |
@tracyboehrer |
@msftshlomiyosef I'm all for this route if it works. Entities in general were made to be subclassed, so obeying the attributes is of benefit. |
Closing this, as it will be handled here: #305 |
Fixes #298
Ensure EntityConverter checks if the value is an AIEntity and delegates serialization, so @type, @context, and @id are included.