Repository navigation
fix ruby model serializer - #4146
Olafur Arason (olafura) wants to merge 1 commit into
Conversation
|
for context to other reviewers microsoftgraph/msgraph-sdk-ruby#185 for information, all the settings are saved here But you won't be able to generate a PR, there are other limitations we need to address in ruby generation for a full generation to work right away. see the CI on this PR for more context Now, the question I have for you: why do you think this guard is necessary? What issue are you running into without it? |
The problem is that we have a bunch of different serializers for the values, so for a nil value you would get:
So there is no way of filtering out the empty values after the serialization step only during it. And the MS Graph doesn't like random values like that. I had a bunch of complaints from it about values being set to an empty string for example |
|
Thanks for the additional information. Are you saying that if you do something like this (sorry, my Ruby is rusty) my_user = new User()
my_user.last_name = "Johnson"
client.users.by_user_id("jane@contoso.com").patch(my_user)you end up with a payload where other properties, that have never been set, end up being sent with their defaults? (e.g. displayName to null/string empty) |
|
Here is an example result from running it: |
Yeah exactly |
|
Thanks for the additional context. If we focus on this string example for a minute, shouldn't this guard clause prevent this behaviour? |
Yeah it seems to be the enum type which casts the nil into a string: model = MicrosoftGraph::Models::OnlineMeeting.new
model.subject = "Subject"
writer = MicrosoftKiotaSerializationJson::JsonSerializationWriter.new
model.serialize(writer)
writer.writer.compact
{"allowMeetingChat"=>"", "allowedPresenters"=>"", "shareMeetingChatHistoryDefault"=>"", "subject"=>"Subject"}I'll create a PR for https://github.com/microsoft/kiota-serialization-json-ruby |
|
Thanks for confirming here. |
I was trying to test it with generating code https://github.com/microsoftgraph/msgraph-sdk-ruby
But I could not figure out the params needed