Skip to content
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

fields deserializers don't need to be passed the current instance in ruby #1663

Closed
Tracked by #1049
baywet opened this issue Jun 27, 2022 · 1 comment · Fixed by #1795
Closed
Tracked by #1049

fields deserializers don't need to be passed the current instance in ruby #1663

baywet opened this issue Jun 27, 2022 · 1 comment · Fixed by #1795
Assignees
Labels
enhancement New feature or request fixed Ruby

Comments

@baywet
Copy link
Member

baywet commented Jun 27, 2022

more details #1490

To reduce the amount of generated code we can remove the object parameter from the field deserializer as the deserializer should be able to capture "this". The abstractions, http and json serialization library will need to be updated too.

"isInline" => lambda {|o, n| o.is_inline = n.get_boolean_value() }

becomes

"isInline" => lambda {|n| @is_inline = n.get_boolean_value() }
@baywet baywet added enhancement New feature or request Ruby labels Jun 27, 2022
@baywet
Copy link
Member Author

baywet commented Aug 17, 2022

Also the usage of the lamdba located here needs to be updated to remove the first parameter.

code example
https://github.com/microsoft/kiota-samples/blob/d3f5a537a8bff85bda1f7fe42ba848e99f3646f4/template/ruby/graphrubyv4/users/message.rb#L298

code location

writer.WriteLine($"\"{otherProp.SerializationName ?? otherProp.Name.ToFirstCharacterLowerCase()}\" => lambda {{|o, n| o.{otherProp.Name.ToSnakeCase()} = n.{GetDeserializationMethodName(otherProp.Type)} }},");

@ghost ghost added the WIP label Aug 29, 2022
@ghost ghost added fixed and removed WIP labels Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed Ruby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants