Skip to content

feat: implement xsd:float codec - #70

Merged
mark-dropbear merged 3 commits into
mainfrom
float
Nov 27, 2025
Merged

mark-dropbear merged 3 commits into
mainfrom
float

Conversation

@mark-dropbear

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @mark-dropbear, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a dedicated codec for the xsd:float data type, which is crucial for accurately representing 32-bit floating-point numbers within the system. By implementing specific validation logic, the change ensures that double values are correctly constrained to the float value space during conversion, preventing data integrity issues and enhancing the library's compliance with XSD standards for numerical types.

Highlights

  • New xsd:float Codec: Implemented a new XsdFloatCodec to handle the conversion between XSD float strings and Dart double values, ensuring proper serialization and deserialization of 32-bit floating-point numbers.
  • 32-bit Float Validation: The codec includes robust validation for both encoding and decoding, utilizing Float32List to check if double values fit within the 32-bit float range. It throws ArgumentError for encoder overflows and FormatException for decoder overflows or underflows.
  • Special Value Handling: The codec correctly handles special floating-point values such as NaN (Not a Number), INF (Positive Infinity), and -INF (Negative Infinity) according to XSD specifications.
  • Documentation and Changelog Updates: The CHANGELOG.md has been updated to reflect the new feature, and the README.md now marks xsd:float as fully supported in the datatype compatibility table.
  • Comprehensive Unit Tests: A new test file, test/codecs/float_codec_test.dart, has been added with extensive unit tests covering valid conversions, invalid string formats, and critical edge cases like overflow and underflow conditions for both encoding and decoding.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a codec for the xsd:float datatype, which is a great addition. The implementation correctly handles the conversion between Dart's 64-bit double and XSD's 32-bit float, including checks for overflow and underflow. The accompanying tests are also well-written. I have a couple of suggestions to enhance correctness and ensure stricter adherence to the XSD specification, along with corresponding test case additions.

Comment thread lib/src/codecs/float/float_codec.dart
Comment thread lib/src/codecs/float/float_codec.dart
Comment thread test/codecs/float_codec_test.dart
Comment thread test/codecs/float_codec_test.dart
@mark-dropbear
mark-dropbear merged commit f12d916 into main Nov 27, 2025
1 check passed
@mark-dropbear
mark-dropbear deleted the float branch November 27, 2025 13:07
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.

1 participant