Skip to content
This repository was archived by the owner on Aug 24, 2026. It is now read-only.

fix enum value serializer - #29

Open
Olafur Arason (olafura) wants to merge 1 commit into
microsoft:mainfrom
olafura:olafura/fix-enum-serializer
Open

fix enum value serializer#29
Olafur Arason (olafura) wants to merge 1 commit into
microsoft:mainfrom
olafura:olafura/fix-enum-serializer

Conversation

@olafura

Copy link
Copy Markdown

The current behaviour transforms a nil into a string before passing it into the write_string_value method.

That means that default value get an empty string. Looking at the documentation Enums are strings and not a list of values.

microsoft/kiota#4146

@sonarqubecloud

sonarqubecloud Bot commented Feb 6, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, can you also please:

  • bump the patch version
  • add a changelog entry
  • add a unit test to prevent regressions

def write_enum_value(key, values)
self.write_string_value(key, values.to_s)
def write_enum_value(key, value)
self.write_string_value(key, value)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.write_string_value(key, value)
self.write_string_value(key, value.to_s) unless value.nil?

What do you think about this alternative?

@baywet

Vincent Biret (baywet) commented Aug 24, 2026

Copy link
Copy Markdown
Member

We're moving everything to microsoft/kiota-abstractions-ruby (which will be named microsoft/kiota-ruby soon). If this pull request is still relevant, please re-open it there.

See microsoft/kiota-ruby#112

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants