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

Integer as string should be defined as string #497

Merged
merged 6 commits into from
Jul 24, 2023

Conversation

mohanapriya2308
Copy link
Contributor

@mohanapriya2308 mohanapriya2308 commented Jul 21, 2023

Fix for #475

parse_data parses integer string also to integers. This breaks when integer string is expected to be string. To fix this, introduced new param parse_integer when set to false, integers are not parsed.

Before
JSON::Validator.fully_validate({type: "string"}, "123")
=> ["The property '#/' of type integer did not match the following type: string in schema"]

After
JSON::Validator.fully_validate({type: "string"}, "123", {"parse_integer" => false)
=> []

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (5dbb4df) 90.08% compared to head (7d04f4f) 90.08%.

❗ Current head 7d04f4f differs from pull request most recent head c9baeef. Consider uploading reports for the commit c9baeef to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #497   +/-   ##
=======================================
  Coverage   90.08%   90.08%           
=======================================
  Files          76       76           
  Lines        1583     1584    +1     
=======================================
+ Hits         1426     1427    +1     
  Misses        157      157           
Impacted Files Coverage Δ
lib/json-schema/validator.rb 85.28% <100.00%> (+0.04%) ⬆️

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

@mohanapriya2308 mohanapriya2308 marked this pull request as draft July 21, 2023 11:18
@mohanapriya2308 mohanapriya2308 marked this pull request as ready for review July 21, 2023 11:20
@mohanapriya2308 mohanapriya2308 marked this pull request as draft July 21, 2023 11:38
@mohanapriya2308 mohanapriya2308 marked this pull request as ready for review July 21, 2023 15:47
@bastelfreak
Copy link
Member

@mohanapriya2308 thanks for the fix!

@bastelfreak bastelfreak merged commit 9334461 into voxpupuli:master Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants