Skip to content

fix(serialization-text): write zero int, float and timedelta values - #804

Merged
Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
anishmehta24:fix/text-zero-values
Oct 15, 2026
Merged

Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
anishmehta24:fix/text-zero-values

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

Overview

TextSerializationWriter.write_int_value, write_float_value and write_timedelta_value skip falsy values, so 0, 0.0 and timedelta(0) write nothing and get_serialized_content() raises No content was written to the serialization writer. The JSON and form writers both write zero. This checks for None instead.

Related Issue

None, found while reading the text writer.

Testing Instructions

  • cd packages/serialization/text && pytest
  • test_write_zero_values (int 0, float 0.0, timedelta(0)) fails on main with the "No content was written" exception and passes with this change.

write_int_value, write_float_value and write_timedelta_value skipped
falsy values, so 0, 0.0 and timedelta(0) wrote nothing and
get_serialized_content raised "No content was written". Check for
None instead, as the JSON and form writers do.
@anishmehta24
Anish Mehta (anishmehta24) requested a review from a team as a code owner October 15, 2026 11:44
Copilot AI balanced review requested due to automatic review settings October 15, 2026 11:45

This comment was marked as off-topic.

@sonarqubecloud

Copy link
Copy Markdown

@baywet
Vincent Biret (baywet) requested a balanced review from Copilot October 15, 2026 12:12

@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!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused changes correctly handle zero values and include regression coverage for each affected method.

0 open findings

🧠 Review effort: Balanced

@baywet
Vincent Biret (baywet) merged commit 0c05596 into microsoft:main Oct 15, 2026
63 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

3 participants