Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds reader for valid_values #265

Merged
merged 1 commit into from
May 23, 2023
Merged

Conversation

popematt
Copy link
Contributor

Issue #, if available:

#256

Description of changes:

  • Adds ValidValuesReader and tests
  • Adds extension functions for converting from IonValue to NumberRange and TimestampRange.
  • While working on this, I ran into problems with the BigDecimal and Timestamp both having inconsistent compareTo and equals, so I introduced ConsistentDecimal and ConsistentTimestamp as wrappers that properly implement equals(), compareTo() and hashCode() in a way that all three are consistent with each other.
  • There is also an incidental change to ReaderTests that makes the test failure messages a little bit more helpful.

Related PRs in ion-schema, ion-schema-tests, ion-schema-schemas:

None

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@popematt popematt requested a review from desaikd May 23, 2023 17:18
@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Patch coverage: 84.61% and project coverage change: +0.15 🎉

Comparison is base (ebf5c41) 82.34% compared to head (484388a) 82.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #265      +/-   ##
==========================================
+ Coverage   82.34%   82.50%   +0.15%     
==========================================
  Files         124      127       +3     
  Lines        3098     3149      +51     
  Branches      732      744      +12     
==========================================
+ Hits         2551     2598      +47     
+ Misses        332      327       -5     
- Partials      215      224       +9     
Impacted Files Coverage Δ
...lin/com/amazon/ionschema/reader/internal/ranges.kt 82.22% <77.27%> (-5.28%) ⬇️
...in/com/amazon/ionschema/model/ConsistentDecimal.kt 85.71% <85.71%> (ø)
.../com/amazon/ionschema/model/ConsistentTimestamp.kt 85.71% <85.71%> (ø)
...a/reader/internal/constraints/ValidValuesReader.kt 93.33% <93.33%> (ø)
...amazon/ionschema/reader/internal/TypeReaderV2_0.kt 92.64% <100.00%> (+0.10%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Test
fun `canRead should return false for any field other than 'valid_values'`() {
val reader = ValidValuesReader()
Assertions.assertFalse(reader.canRead("valeurs_valides"))
Copy link
Contributor

Choose a reason for hiding this comment

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

très bien 👍🏻

@popematt popematt merged commit e2f01e4 into amazon-ion:master May 23, 2023
@popematt popematt deleted the read-valid-values branch June 13, 2024 22:35
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.

2 participants