-
Notifications
You must be signed in to change notification settings - Fork 13
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
Unsupported Data Type with Class Pointers #28
Comments
Troubleshooting updatesIf the pointer for the func TestAdditionalDataMapPointers(t *testing.T) {
serializer := NewJsonSerializationWriter()
data := "a string"
aNum := 2
aBool := false
var ifce error
adlData := map[string]interface{}{
"type": JsonParseNode{},
"isDelegated": true,
"location": map[string]*string{"displayName": (*string)(&data),
"locationType": (*string)(&data),
"uniqueIdType": (*string)(&data)},
"startDateTime": map[string]*int{"dateTime": (*int)(&aNum),
"timeZone": (*int)(&aNum)},
"endDateTime": map[string]int{"dateTime": *(*int)(&aNum),
"timeZone": *(*int)(&aNum)},
"meetingMessageType": &data,
"meetingRequestType": &aNum,
"@odata.type": NewJsonSerializationWriterFactory(),
"@odata.etag": "W/\"CwAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAAAAAsl\"",
"isOutOfDate": &aBool,
"responseRequested": aBool,
"isAllDay": ifce,
}
err := serializer.WriteAdditionalData(adlData)
t.Logf("Error: %v\n", err)
} The current version passes the above test case. |
Hi @dadams39, What I don't understand is why store the location information as an additional data entry when the event model has a location field ? |
The original query to msgraph is: |
I'm going to attempt to add in that functionality. I will include the above test in. If you think of additional tests that you feel are necessary, please notify me here. |
thanks for the additional information. For the odata type, it is expected since neither message/event, outlook item (parent) or entity (grand parent) have a defined property for it. For location, it is not expected since the model has a field for it. |
We don't seem to have a handler for Any suggestions? |
- Initial look at adding maps to writer for primative types
I'd rather fix the deserialization process instead to make sure we don't get into a situation where we have a JsonParseNode in the deserialized model. |
That's fair. How would we go about that? |
PR #29 submitted to add the functionality for mapping. Unfortunately, I cannot tell if this fix alone will take care of the errors I was getting when I started. When I tried to checkout my branch, I received the following error:
|
@baywet, do we have any leads on the deserialization change that needs to happen?
|
Hi @dadams39 |
The root cause for this error is the incorrect serialization of Strategy:
|
@baywet PR #29 is a feature update as the mapping that I troubleshot here is the byproduct of eventMessageResponses being incorrectly serialized as messages. The failure of #28 is a separate issue which I have given steps for troubleshooting. This should present insight on #30, but I won't know until I get deeper into the results. |
Verified the Will start troubleshooting from step 1. |
Line 245: err := item.Serialize(w) --> err := m.OutlookItem.Serialize(writer) // Line 686 Fails on AdditionalData
|
The proposed fix is a temporary fix. Objects of "@odata.type": "#microsoft.graph.eventMessageRequest", Serialize with the additonalData keys: "startDateTime": ,
"isDelegated":,
"responseRequested":,
"@odata.type":
"meetingMessageType":
"@odata.etag":,
"endDateTime":
"type":
"@odata.context":
"meetingRequestType":
"isOutOfDate":
"isAllDay":
map[string]*github.com/microsoft/kiota-serialization-json-go.JsonParseNode ["dateTime": *(*"github.com/microsoft/kiota-serialization-json-go.JsonParseNode")(0x140002088d0), "timeZone": *(*"github.com/microsoft/kiota-serialization-json-go.JsonParseNode")(0x14000208930), ] The change I proposed introduces a |
Changes ensure that the collections are properly deliminated and map support for @odata.type --> microsoft.graph.eventMessageRequest
Test case extended to ensure support for microsoft.graph.eventMessageResponse
Thanks for digging into this, let's take a step back for a second. On this list of properties
Only these should be in the additional data
Because the SDK has properties defined also here All the properties that are expected to end up as additional properties are of type string, and there's already a case to handle it. Now, looking further in that direction, the reason why we find these properties in additional data instead of their fields, is because you're getting a message object instead of an event message request object. This is because the the discriminator method doesn't contain an entry for eventRequestMessage. These entries are dictated by the conversion library before the SDK is being generated, and we already have an issue for this. The next steps are to:
As I eluded in other issues, our team has a number of people out for various reasons, and we've just uncovered a number of conversion issues (including the one impacting us here), so this is likely to take a couple of weeks to be fixed end to end. Thank you for your patience. Regarding your PR, I do believe some of the changes are valuable including:
I however don't believe adding cases for map[string]something is valuable at this point for the reasons I've explained above and to avoid deviating too much from other languages. If you're willing to clean it up, we'll be more than happy to merge it. I hope this lengthy post clarifies the situation and provides an explanation to the root cause. Don't hesitate if you have questions/comments, and thank you so much for your extended participation in the Go SDK. |
This issue relates to and the issue microsoft/kiota#648. Previously event docs stated that it was possible to receive messages from the Teams application during this call. This was a condition in legacy (or perhaps it lingers even now), but it points to a common problem that the serialization library will have to face. As new services and objects become available, additionalData may have to hold some of these properties until the supporting discriminator functions can be fine tuned. The issue was created because a query for mail returns several different types of mail, including EventMessage which falls into the space of being "newly" created in the last few versions. // EventMessageable
type EventMessageable interface {
Messageable
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
GetEndDateTime()(DateTimeTimeZoneable)
GetEvent()(Eventable)
... at a glance, it is likely we will run into this again as the functionality expands. I understand the lack of resources within the team, and I will do what I can to help. I do need to get this issue resolved though. My next steps are:
|
Thanks for your understanding. The addition of new derived types and SDKs running in production "behind" is a topic we've talked a lot about both in our API design guidance sessions and later in our Kiota design work. This a big reason why we have additional data and why that additional data supports serializing "generic" JsonParseNode so gaps in the schemas/api descriptions can be bridged without breaking applications. |
As per the agreement within the Issue, mapping capability has been removed until further notice. Test suites adjusted accordingly.
A question concerning this. Currently, one can only call |
This is an interesting question, which could be interpreted a couple of different ways. "Is there a way to get only eventMessages?" "Could I get eventMessages deserialized to the right eventMessage struct instead of the base message type?" {
"@odata.type": "#microsoft.graph.eventMessageRequest",
"@odata.etag": "W/\"CwAAABYAAAAs+XSiyjZdS4Rhtwk0v1pGAADoHTot\"",
"id": "AAMkAGNmMGZiNjM5LTZmMDgtNGU2OS1iYmUwLWYwZDc4M2ZkOGY1ZQBGAAAAAAAK20ulGawAT7z-yx90ohp-BwAs_XSiyjZdS4Rhtwk0v1pGAAAAAAEJAAAs_XSiyjZdS4Rhtwk0v1pGAADoYRf4AAA=",
"subject": "very important meeting"
} After querying the service you can type assert the object, with something like this if eventMessage, isEventMessage := messageInstance.(models.EventMessageable); isEventMessage {
eventMessage.GetMeetingMessageType() // this property is specific to the derived type and wouldn't be accessible without the assertion
} |
Thanks for the thorough reply. I did see: https://github.com/microsoftgraph/msgraph-sdk-go/blob/eb2d097f9010a618832461f649740084d7823b02/models/message.go#L97. However, this requires a parsenode and the response return value is that of a The interesting thing is that there is an eventMessageRequest and eventMessageResponse and these derived types will both load information into the additional data struct when converted to a messageable object. The interesting thing is if one creates either of these structs, one cannot pass along the valid additional data from the original. I'm curious as to what implications this will have for this library in particular. From an internal standpoint, it would be a nice feature to be able to set additional data in new objects. |
event message request & response: this is where we're missing some information and we're working in the conversion library to get this fixed. Message should contain entries for event response and event request so you get the right type all the way. microsoft/OpenAPI.NET.OData#240 Allowing to set things in additional data from a new model: we do have some support for that for scalar values as you already know. One of the reasons why we're not investing in more advanced scenarios in that space is because we'd rather have better models generation and downcast support for people to use them and get better value. Another reason is if we start putting complex types that don't implement parsable is this library won't know what to do with them. |
Closing since this has been addressed in the conversion library and the SDK now has all the mapping information. |
Upon writing M365 data with
JsonSerializationWriter.WriteObjectValue()
Receiving error:
It should be noted that when the messageId is pulled from Graph Explorer the Writer is able to parse it correctly. However, I have seen this failure on multiple types of mail. Two different additional data headers are included below:
Number 1:
Number 2:
The text was updated successfully, but these errors were encountered: