Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

fix: handle string timestamp in DiscountOfferInputIOS#26

Merged
hyochan merged 1 commit intomainfrom
fix/DiscountOfferInputIOS-types
Oct 16, 2025
Merged

fix: handle string timestamp in DiscountOfferInputIOS#26
hyochan merged 1 commit intomainfrom
fix/DiscountOfferInputIOS-types

Conversation

@hyochan
Copy link
Member

@hyochan hyochan commented Oct 16, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced timestamp parsing to accept both Double and string numeric formats.
  • Chores

    • Updated gql dependency to version 1.2.2.

@hyochan hyochan added the 🛠 bugfix All kinds of bug fixes label Oct 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

Walkthrough

The changes add custom Codable serialization/deserialization to DiscountOfferInputIOS to support timestamp as either Double or numeric String, and update the gql dependency version from 1.2.1 to 1.2.2.

Changes

Cohort / File(s) Summary
Custom Codable Implementation
Sources/Models/Types.swift
Added custom Codable conformance with private CodingKeys enum, explicit init(from decoder:) and encode(to encoder:) methods. Timestamp field now accepts Double or numeric String during decoding.
Dependency Update
openiap-versions.json
Updated gql dependency version from 1.2.1 to 1.2.2.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

The dependency version bump is trivial, and the custom Codable implementation follows a straightforward pattern. The timestamp parsing logic with error handling adds minor complexity but remains confined to a single struct with clear intent.

Poem

🐰 ✨ A timestamp's many forms we now embrace,
Double or String—both find their place!
While gql hops forward to 1.2.2's grace,
Our Codable magic keeps encoding race!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly identifies that the change fixes the handling of string timestamps in the DiscountOfferInputIOS type, which directly matches the main update of adding custom Codable conformance to accept string or numeric timestamp values.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/DiscountOfferInputIOS-types

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24d8545 and 8f3f84b.

📒 Files selected for processing (2)
  • Sources/Models/Types.swift (1 hunks)
  • openiap-versions.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
Sources/**/*.swift

📄 CodeRabbit inference engine (CLAUDE.md)

Sources/**/*.swift: iOS-specific functions MUST have IOS suffix
Android-specific functions MUST have Android suffix
Cross-platform functions must have NO platform suffix
Acronyms in Swift should be ALL CAPS only when used as a suffix; otherwise use Pascal case (first letter caps, rest lowercase)
Specific casing: iOS -> Ios in beginning/middle, IOS as suffix
Specific casing: IAP -> Iap in beginning/middle, IAP as suffix
Specific casing: API -> Api in beginning/middle, API as suffix
Specific casing: URL -> Url in beginning/middle, URL as suffix
OpenIapError static code constants use PascalCase names; raw string values remain E_ codes; avoid introducing new E_-prefixed identifiers in Swift

Files:

  • Sources/Models/Types.swift
Sources/Models/Types.swift

📄 CodeRabbit inference engine (CLAUDE.md)

Types.swift in Sources/Models is auto-generated; DO NOT edit directly

Files:

  • Sources/Models/Types.swift
Sources/Models/**/*.swift

📄 CodeRabbit inference engine (CLAUDE.md)

Models must match OpenIAP specification exactly (official types only)

Files:

  • Sources/Models/Types.swift
openiap-versions.json

📄 CodeRabbit inference engine (CLAUDE.md)

openiap-versions.json: Version management is in openiap-versions.json; update versions there (not elsewhere)
Commit changes to openiap-versions.json when updating versions

Files:

  • openiap-versions.json
🧠 Learnings (2)
📚 Learning: 2025-10-09T19:13:15.972Z
Learnt from: CR
PR: hyodotdev/openiap-apple#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-09T19:13:15.972Z
Learning: Applies to openiap-versions.json : Version management is in openiap-versions.json; update versions there (not elsewhere)

Applied to files:

  • openiap-versions.json
📚 Learning: 2025-10-09T19:13:15.972Z
Learnt from: CR
PR: hyodotdev/openiap-apple#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-09T19:13:15.972Z
Learning: Applies to openiap-versions.json : Commit changes to openiap-versions.json when updating versions

Applied to files:

  • openiap-versions.json
🧬 Code graph analysis (1)
Sources/Models/Types.swift (1)
Sources/Models/OpenIapSerialization.swift (3)
  • decode (35-41)
  • decode (43-52)
  • encode (22-31)
🔇 Additional comments (2)
openiap-versions.json (1)

3-3: LGTM!

The gql dependency version update from 1.2.1 to 1.2.2 is correctly placed in the version management file.

Based on learnings

Sources/Models/Types.swift (1)

584-617: Custom Codable implementation is technically correct.

The flexible timestamp decoding logic properly handles both Double and String formats with clear error messages. The encoder consistently outputs Double, maintaining type safety.

However, this approval assumes the code generation process preserves these customizations (see previous comment).


Comment @coderabbitai help to get the list of available commands and usage tips.

@hyochan hyochan merged commit b587910 into main Oct 16, 2025
2 checks passed
@hyochan hyochan deleted the fix/DiscountOfferInputIOS-types branch October 16, 2025 08:30
hyochan added a commit to hyochan/react-native-iap that referenced this pull request Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🛠 bugfix All kinds of bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant