Skip to content

Conversation

@olafura
Copy link

@olafura olafura commented Feb 6, 2024

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
Copy link

sonarqubecloud bot commented Feb 6, 2024

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

Copy link
Member

@baywet baywet left a comment

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
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?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants