Skip to content

fix(serialization): support double, byte array, and enum in form serialization - #2234

Merged
Vincent Biret (baywet) merged 7 commits into
microsoft:mainfrom
hardikkaurani:fix/form-serialization-double-bytes-and-enums
Nov 4, 2026
Merged

Vincent Biret (baywet) merged 7 commits into
microsoft:mainfrom
hardikkaurani:fix/form-serialization-double-bytes-and-enums

Conversation

@hardikkaurani

Copy link
Copy Markdown
Contributor

Description

This pull request addresses missing type support in form serialization and deserialization components:

  1. *Support \Double\ in \FormSerializationWriter.writeAnyValue*

    • While \FormSerializationWriter.writeDoubleValue\ is provided, \writeAnyValue\ previously lacked handling for \Double.class, which caused collection serialization (\writeCollectionOfPrimitiveValues) and additional data serialization containing double values to fail with \RuntimeException: unknown type to serialize java.lang.Double.
    • Added \Double.class\ branch mapping to \writeDoubleValue.
  2. *Support \�yte[]\ and Enum Values in \FormSerializationWriter.writeAnyValue*

    • Added support for \�yte[].class, delegating to \writeByteArrayValue\ (Base64 URL-encoded serialization).
    • Added support for \ValuedEnum\ and \Enum<?>, writing their string representations (\getValue()\ /
      ame()) consistently with other Kiota serialization writers.
  3. *Support \�yte[]\ in \FormParseNode.convertPrimitiveValue*

    • \FormParseNode\ supported single \getByteArrayValue()\ via Base64 decoding, but \convertPrimitiveValue\ lacked a branch for \�yte[].class, throwing \RuntimeException: unknown type to deserialize [B\ when calling \getCollectionOfPrimitiveValues(byte[].class).
    • Extracted shared \parseByteArrayValue\ static helper and added \�yte[].class\ handling to \convertPrimitiveValue.
  4. Tests

    • Added regression tests in \FormSerializationWriterTests\ verifying serialization of doubles, byte arrays, and enums in additional data and primitive collections.
    • Added regression test \parsesCollectionOfByteArrayValues\ in \ParseNodeTests.

…um in form serialization

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…yValue

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…riter writeAnyValue

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…iveValue

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
@hardikkaurani
Hardik K (hardikkaurani) requested a review from a team as a code owner November 3, 2026 18:02
Copilot AI balanced review requested due to automatic review settings November 3, 2026 18:02

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@hardikkaurani

Copy link
Copy Markdown
Contributor Author

Hi Vincent Biret (@baywet),

Opened this PR to address a few type serialization gaps in the form serialization components:

  • \FormSerializationWriter.writeAnyValue\ was missing handlers for \Double.class, \�yte[].class, and \Enum/\ValuedEnum, which caused runtime exceptions when serializing collections of primitives or entities with these types in \�dditionalData.
  • \FormParseNode.convertPrimitiveValue\ was similarly missing \�yte[].class\ handling for \getCollectionOfPrimitiveValues(byte[].class).

Added regression tests covering primitive collections and additional data for all three types, and verified all unit tests and spotless formatting pass locally. Whenever you have a chance, please take a look.

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.

🟡 Changes recommended

Byte-array collection parsing corrupts Base64 values containing + through double URL decoding and treats null markers as byte arrays, breaking round-trip behavior.

2 open issues

Review effort: Balanced

…rker in byte array collections

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 19:57

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@hardikkaurani

Copy link
Copy Markdown
Contributor Author

Vincent Biret (@baywet) Addressed the review feedback regarding collection byte array handling: removed the redundant URL decoding in \FormParseNode\ so Base64 values containing +\ are not corrupted, and added null-marker recognition in \parseByteArrayValue\ so null elements in collections deserialize to
ull. Added regression and round-trip tests covering both cases; all unit tests and Spotless formatting pass cleanly.

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

No active review issues block approval of the form serialization changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@hardikkaurani

Copy link
Copy Markdown
Contributor Author

Thanks for the review Vincent Biret (@baywet) .

…ript dependencies

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 20:20

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Comment thread settings.gradle Resolved
…s.gradle

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 20:36

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@hardikkaurani

Hardik K (hardikkaurani) commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Vincent Biret (@baywet) Reverted the settings.gradle change to keep this PR strictly focused on the form serialization improvements. The change was initially introduced in response to a transient CodeQL autobuild failure caused by plugins.gradle.org failing to resolve Spotless plugin dependencies. All form serialization tests and build checks continue to pass cleanly.

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

There are no active review issues for the form serialization and byte-array deserialization changes.

No open issues 🎉

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this to In Progress 🚧 in Kiota Nov 4, 2026
@baywet
Vincent Biret (baywet) merged commit fd72de3 into microsoft:main Nov 4, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota Nov 4, 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