Skip to content

Implement xsd:gYear codec and data type#45

Merged
mark-dropbear merged 3 commits intomainfrom
feat/add-gYear-codec
Jul 1, 2025
Merged

Implement xsd:gYear codec and data type#45
mark-dropbear merged 3 commits intomainfrom
feat/add-gYear-codec

Conversation

@mark-dropbear
Copy link
Copy Markdown
Contributor

No description provided.

google-labs-jules bot and others added 2 commits July 1, 2025 19:38
Adds support for the xsd:gYear XML Schema data type.

Includes:
- A `Year` class in `lib/src/types/year.dart` to represent gYear values, handling positive/negative years and optional timezones.
- A `YearCodec` in `lib/src/codecs/g_year/year_codec.dart` for encoding and decoding gYear values.
- Unit tests for both the `Year` type and `YearCodec`.
- Exports for the new type and codec in `lib/xsd.dart`.
@mark-dropbear mark-dropbear linked an issue Jul 1, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

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 significantly extends the library's XML Schema Definition (XSD) datatype support by fully implementing the xsd:gYear built-in type. It introduces a new GregorianYear class to model this datatype, complete with robust parsing and serialization logic, and integrates it into the existing codec system. This enhancement allows for accurate handling of year-only date representations as defined by the XSD 1.1 specification.

Highlights

  • New Data Type: xsd:gYear: Introduces the GregorianYear class to represent xsd:gYear values, including support for year (positive, negative, and zero) and optional timezone offsets, adhering to the XSD 1.1 specification.
  • Parsing and Serialization: Implements GregorianYear.parse() for converting XSD gYear lexical forms into GregorianYear objects, and GregorianYear.toString() for canonical serialization, ensuring correct year padding and timezone representation.
  • Codec Integration: Provides GregorianYearCodec along with dedicated encoder and decoder classes to facilitate seamless conversion between GregorianYear objects and their string representations within the library's existing codec framework.
  • Comprehensive Testing: Adds extensive unit tests for both the GregorianYear data type and its associated codec, ensuring correctness and robustness across various valid and invalid input scenarios, including edge cases for years and timezones.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.

Copy link
Copy Markdown
Contributor

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

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 support for the xsd:gYear data type. A potential correctness issue was identified in the regular expression used for parsing gYear strings, which might reject some valid inputs. The feedback includes a suggested fix for the regex to make it more compliant with the XSD specification.

@mark-dropbear mark-dropbear merged commit 1f23fb8 into main Jul 1, 2025
1 check passed
@mark-dropbear mark-dropbear deleted the feat/add-gYear-codec branch November 27, 2025 15:08
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.

Implement codec for xsd:gYear data type

1 participant