-
Notifications
You must be signed in to change notification settings - Fork 52
Now serializing empty lists #280
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
Merged
tracyboehrer
merged 1 commit into
main
from
users/tracyboehrer/activity-init-collections
May 13, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
43 changes: 43 additions & 0 deletions
43
...Agents.Extensions.Teams/Serialization/Converters/MessagingExtensionAttachmentConverter.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,57 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Agents.Core.Serialization; | ||
using Microsoft.Agents.Core.Serialization.Converters; | ||
using Microsoft.Agents.Extensions.Teams.Models; | ||
using System.Text.Json; | ||
|
||
namespace Microsoft.Agents.Extensions.Teams.Serialization.Converters | ||
{ | ||
// This is required because ConnectorConverter supports derived type handling. | ||
// In this case for the 'Task' property of type TaskModuleResponseBase. | ||
internal class MessagingExtensionAttachmentConverter : ConnectorConverter<MessagingExtensionAttachment> | ||
{ | ||
/// <inheritdoc/> | ||
protected override void ReadExtensionData(ref Utf8JsonReader reader, MessagingExtensionAttachment value, string propertyName, JsonSerializerOptions options) | ||
{ | ||
var extensionData = JsonSerializer.Deserialize<JsonElement>(ref reader, options); | ||
value.Properties.Add(propertyName, extensionData); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override bool TryReadExtensionData(ref Utf8JsonReader reader, MessagingExtensionAttachment value, string propertyName, JsonSerializerOptions options) | ||
{ | ||
if (!propertyName.Equals(nameof(value.Properties))) | ||
{ | ||
return false; | ||
} | ||
|
||
var propertyValue = JsonSerializer.Deserialize<object>(ref reader, options); | ||
|
||
foreach (var element in propertyValue.ToJsonElements()) | ||
{ | ||
value.Properties.Add(element.Key, element.Value); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override bool TryWriteExtensionData(Utf8JsonWriter writer, MessagingExtensionAttachment value, string propertyName) | ||
{ | ||
if (!propertyName.Equals(nameof(value.Properties))) | ||
{ | ||
return false; | ||
} | ||
|
||
foreach (var extensionData in value.Properties) | ||
{ | ||
writer.WritePropertyName(extensionData.Key); | ||
extensionData.Value.WriteTo(writer); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ests/Microsoft.Agents.Extensions.Teams.Tests/Model/TestJson/MessagingExtensionAction.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"commandId":"commandId","commandContext":"commandContext","botMessagePreviewAction":"botMessagePreviewAction","botActivityPreview":[{"type":"message"}],"messagePayload":{"id":"id","replyToId":"replyToId","messageType":"messageType","createdDateTime":"2025-06-15T13:45:30","lastModifiedDateTime":"2025-07-17T14:46:40","deleted":false,"subject":"subject","summary":"summary","importance":"importance","locale":"locale","from":{"user":{"userIdentityType":"userIdentityType","id":"id","displayName":"displayName"},"application":{"applicationIdentityType":"applicationIdentityType","id":"id","displayName":"displayName"},"conversation":{"conversationIdentityType":"conversationIdentityType","id":"id","displayName":"displayName"}},"body":{"contentType":"contentType","content":"content"},"attachmentLayout":"attachmentLayout","attachments":[{"id":"id","contentType":"contentType","contentUrl":"contentUrl","content":"content","name":"name","thumbnailUrl":"thumbnailUrl"}],"mentions":[{"id":1,"mentionText":"mentionText","mentioned":{}}],"reactions":[{"reactionType":"reactionType","createdDateTime":"createdDateTime","user":{}}]}} | ||
{"commandId":"commandId","commandContext":"commandContext","botMessagePreviewAction":"botMessagePreviewAction","botActivityPreview":[{"type":"message","membersAdded":[],"membersRemoved":[],"reactionsAdded":[],"reactionsRemoved":[],"attachments":[],"entities":[],"listenFor":[],"textHighlights":[]}],"messagePayload":{"id":"id","replyToId":"replyToId","messageType":"messageType","createdDateTime":"2025-06-15T13:45:30","lastModifiedDateTime":"2025-07-17T14:46:40","deleted":false,"subject":"subject","summary":"summary","importance":"importance","locale":"locale","from":{"user":{"userIdentityType":"userIdentityType","id":"id","displayName":"displayName"},"application":{"applicationIdentityType":"applicationIdentityType","id":"id","displayName":"displayName"},"conversation":{"conversationIdentityType":"conversationIdentityType","id":"id","displayName":"displayName"}},"body":{"contentType":"contentType","content":"content"},"attachmentLayout":"attachmentLayout","attachments":[{"id":"id","contentType":"contentType","contentUrl":"contentUrl","content":"content","name":"name","thumbnailUrl":"thumbnailUrl"}],"mentions":[{"id":1,"mentionText":"mentionText","mentioned":{}}],"reactions":[{"reactionType":"reactionType","createdDateTime":"createdDateTime","user":{}}]}} |
2 changes: 1 addition & 1 deletion
2
...rosoft.Agents.Extensions.Teams.Tests/Model/TestJson/MessagingExtensionActionResponse.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"task":{"type":"message","prop1":"prop1"},"composeExtension":{"attachmentLayout":"attachmentLayout","type":"type","attachments":[{"properties":{}}],"suggestedActions":{"actions":[{"type":"type","title":"title","image":"image","imageAltText":"imageAltText","text":"text","displayText":"displayText","value":{"value":"value"},"channelData":{"channelData":"channelData"}}]},"text":"text","activityPreview":{}},"cacheInfo":{"cacheType":"cacheType","cacheDuration":1}} | ||
{"task":{"type":"message","prop1":"prop1"},"composeExtension":{"attachmentLayout":"attachmentLayout","type":"type","attachments":[{}],"suggestedActions":{"actions":[{"type":"type","title":"title","image":"image","imageAltText":"imageAltText","text":"text","displayText":"displayText","value":{"value":"value"},"channelData":{"channelData":"channelData"}}]},"text":"text","activityPreview":{"membersAdded":[],"membersRemoved":[],"reactionsAdded":[],"reactionsRemoved":[],"attachments":[],"entities":[],"listenFor":[],"textHighlights":[]}},"cacheInfo":{"cacheType":"cacheType","cacheDuration":1}} |
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
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
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
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
40 changes: 39 additions & 1 deletion
40
src/tests/Microsoft.Agents.Model.Tests/Resources/cps_event_out.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,39 @@ | ||
{"type":"event","id":"470d790f-dcfb-4e7e-9d38-fdae48fcdba0","timestamp":"2024-11-14T03:21:53.5114019\u002B00:00","channelId":"pva-published-engine-direct","from":{"id":"9c73e213-d1a5-edcd-9eee-2db79aadb10f/806d3d4a-5c95-ef11-8a6a-6045bd03ceab","name":"crd17_getsCurrentWeather","role":"bot"},"conversation":{"id":"fe5203d5-03ce-44f1-8fb7-d26bf06ee40f"},"recipient":{"id":"94219457-c13e-44ca-b91c-24078a4997c6","aadObjectId":"94219457-c13e-44ca-b91c-24078a4997c6","role":"user"},"channelData":{"streamType":"final","streamId":"e5084817-2e0d-4fca-bb27-3eca80ae49f8"},"replyToId":"406ffa1e-67a7-4ec9-9eef-f90cfbe0e389","valueType":"DynamicPlanStepBindUpdate","value":{"taskDialogId":"crd17_getsCurrentWeather.topic.MSNWeatherGetcurrentweather","arguments":{"units":"I","Location":"New York"}},"name":"DynamicPlanStepBindUpdate"} | ||
{ | ||
"type": "event", | ||
"id": "470d790f-dcfb-4e7e-9d38-fdae48fcdba0", | ||
"timestamp": "2024-11-14T03:21:53.5114019\u002B00:00", | ||
"channelId": "pva-published-engine-direct", | ||
"from": { | ||
"id": "9c73e213-d1a5-edcd-9eee-2db79aadb10f/806d3d4a-5c95-ef11-8a6a-6045bd03ceab", | ||
"name": "crd17_getsCurrentWeather", | ||
"role": "bot" | ||
}, | ||
"conversation": { "id": "fe5203d5-03ce-44f1-8fb7-d26bf06ee40f" }, | ||
"recipient": { | ||
"id": "94219457-c13e-44ca-b91c-24078a4997c6", | ||
"aadObjectId": "94219457-c13e-44ca-b91c-24078a4997c6", | ||
"role": "user" | ||
}, | ||
"membersAdded": [], | ||
"membersRemoved": [], | ||
"reactionsAdded": [], | ||
"reactionsRemoved": [], | ||
"attachments": [], | ||
"entities": [], | ||
"channelData": { | ||
"streamType": "final", | ||
"streamId": "e5084817-2e0d-4fca-bb27-3eca80ae49f8" | ||
}, | ||
"replyToId": "406ffa1e-67a7-4ec9-9eef-f90cfbe0e389", | ||
"valueType": "DynamicPlanStepBindUpdate", | ||
"value": { | ||
"taskDialogId": "crd17_getsCurrentWeather.topic.MSNWeatherGetcurrentweather", | ||
"arguments": { | ||
"units": "I", | ||
"Location": "New York" | ||
} | ||
}, | ||
"name": "DynamicPlanStepBindUpdate", | ||
"listenFor": [], | ||
"textHighlights": [] | ||
} |
46 changes: 45 additions & 1 deletion
46
src/tests/Microsoft.Agents.Model.Tests/Resources/cps_greeting_out.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,45 @@ | ||
{"type":"message","id":"8a82a3f3-cddf-444b-b607-58c79f3486b8","timestamp":"2024-11-14T03:18:57.5507994\u002B00:00","channelId":"pva-published-engine-direct","from":{"id":"9c73e213-d1a5-edcd-9eee-2db79aadb10f/806d3d4a-5c95-ef11-8a6a-6045bd03ceab","name":"crd17_getsCurrentWeather","role":"bot"},"conversation":{"id":"fe5203d5-03ce-44f1-8fb7-d26bf06ee40f"},"recipient":{"id":"94219457-c13e-44ca-b91c-24078a4997c6","aadObjectId":"94219457-c13e-44ca-b91c-24078a4997c6","role":"user"},"textFormat":"markdown","text":"Hello, I\u0027m Gets Current weather, a virtual assistant. I can answer general questions about the current weather as well as forecasts for today and tomorrow. Just so you are aware, I sometimes use AI to answer your questions.\n\n_**Note**: You can now customize this copilot\u0027s topics and knowledge for your own needs. For more information about this template and how to modify it, visit the template [documentation.](https://go.microsoft.com/fwlink/?linkid=2271069)_","speak":"Thanks for calling, how can I help?","inputHint":"acceptingInput","suggestedActions":{"actions":[{"type":"imBack","title":"What can I ask?","text":"What can I ask?","value":"What can I ask?"}]},"channelData":{"streamType":"final","streamId":"8a82a3f3-cddf-444b-b607-58c79f3486b8"},"replyToId":"b7b28891-a1a4-460d-ad37-11326f46fead"} | ||
{ | ||
"type": "message", | ||
"id": "8a82a3f3-cddf-444b-b607-58c79f3486b8", | ||
"timestamp": "2024-11-14T03:18:57.5507994\u002B00:00", | ||
"channelId": "pva-published-engine-direct", | ||
"from": { | ||
"id": "9c73e213-d1a5-edcd-9eee-2db79aadb10f/806d3d4a-5c95-ef11-8a6a-6045bd03ceab", | ||
"name": "crd17_getsCurrentWeather", | ||
"role": "bot" | ||
}, | ||
"conversation": { "id": "fe5203d5-03ce-44f1-8fb7-d26bf06ee40f" }, | ||
"recipient": { | ||
"id": "94219457-c13e-44ca-b91c-24078a4997c6", | ||
"aadObjectId": "94219457-c13e-44ca-b91c-24078a4997c6", | ||
"role": "user" | ||
}, | ||
"textFormat": "markdown", | ||
"membersAdded": [], | ||
"membersRemoved": [], | ||
"reactionsAdded": [], | ||
"reactionsRemoved": [], | ||
"text": "Hello, I\u0027m Gets Current weather, a virtual assistant. I can answer general questions about the current weather as well as forecasts for today and tomorrow. Just so you are aware, I sometimes use AI to answer your questions.\n\n_**Note**: You can now customize this copilot\u0027s topics and knowledge for your own needs. For more information about this template and how to modify it, visit the template [documentation.](https://go.microsoft.com/fwlink/?linkid=2271069)_", | ||
"speak": "Thanks for calling, how can I help?", | ||
"inputHint": "acceptingInput", | ||
"suggestedActions": { | ||
"to": [], | ||
"actions": [ | ||
{ | ||
"type": "imBack", | ||
"title": "What can I ask?", | ||
"text": "What can I ask?", | ||
"value": "What can I ask?" | ||
} | ||
] | ||
}, | ||
"attachments": [], | ||
"entities": [], | ||
"channelData": { | ||
"streamType": "final", | ||
"streamId": "8a82a3f3-cddf-444b-b607-58c79f3486b8" | ||
}, | ||
"replyToId": "b7b28891-a1a4-460d-ad37-11326f46fead", | ||
"listenFor": [], | ||
"textHighlights": [] | ||
} |
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
10 changes: 9 additions & 1 deletion
10
src/tests/Microsoft.Agents.Model.Tests/Resources/cps_typing_out.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
{ | ||
"type": "typing", | ||
"id": "typing-1" | ||
"id": "typing-1", | ||
"membersAdded": [], | ||
"membersRemoved": [], | ||
"reactionsAdded": [], | ||
"reactionsRemoved": [], | ||
"attachments": [], | ||
"entities": [], | ||
"listenFor": [], | ||
"textHighlights": [] | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.