Skip to content

Conversation

@LuukvH
Copy link
Contributor

@LuukvH LuukvH commented Jun 2, 2025

Changes Date.parse to Date.iso8601 to fix incorrect type coercion in OneOf contexts. Previously, arbitrary strings matching Date.parse's lenient pattern (e.g., "ABC1") were incorrectly coerced to dates (2025-06-01), when they should have remained as strings.

For example:

  • "ABC1" was parsed as Date(2025-06-01) instead of remaining "ABC1"
  • This occurred because Date.parse treats the first char as month ('A'=1) and remaining digits as day

The fix ensures only ISO8601 formatted strings (e.g. "2025-06-02") are parsed as dates, improving type safety and preventing unexpected coercion of string values.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Member

wing328 commented Jun 3, 2025

thanks for the pr

please follow step 3 to update the samples when you've time

Changes Date.parse to Date.iso8601 to fix incorrect type coercion in OneOf contexts. Previously, arbitrary strings matching Date.parse's lenient pattern (e.g., "ABC1") were incorrectly coerced to dates (2025-06-01), when they should have remained as strings.

For example:
- "ABC1" was parsed as Date(2025-06-01) instead of remaining "ABC1"
- This occurred because Date.parse treats the first char as month ('A'=1)
  and remaining digits as day

The fix ensures only ISO8601 formatted strings (e.g. "2025-06-02") are parsed as dates, improving type safety and preventing unexpected coercion of string values.
@LuukvH LuukvH force-pushed the ruby-dateparsing branch from 69ad300 to 8924da5 Compare June 3, 2025 08:27
@LuukvH
Copy link
Contributor Author

LuukvH commented Jun 3, 2025

Hi @wing328, I realized I had only partially regenerated the samples earlier — thanks for pointing it out. I've now re-run the full scripts and pushed the updated files. Let me know if anything else is needed!

@wing328
Copy link
Member

wing328 commented Jun 3, 2025

thanks for the pr

let's give it a try

@wing328 wing328 merged commit 81cdc82 into OpenAPITools:master Jun 3, 2025
15 checks passed
@wing328
Copy link
Member

wing328 commented Jun 3, 2025

PR merged

snapshot will be published shortly

please do a test to ensure it's working for your use cases

https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.14.0-SNAPSHOT/

@LuukvH
Copy link
Contributor Author

LuukvH commented Jun 4, 2025

@wing328 I’m not seeing a new snapshot yet. I was hoping to test the behavior, but it looks like no new versions have been published. Am I missing something, or could there be an issue with the snapshot generation?

@LuukvH LuukvH deleted the ruby-dateparsing branch June 26, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants