voxpupuli / json-schema

Ruby JSON Schema Validator
MIT License
1.52k stars 241 forks source link

Add `allPropertiesRequired` and `noAdditionalProperties` options #494

Closed a-lavis closed 1 year ago

a-lavis commented 1 year ago

Adds the allPropertiesRequired and noAdditionalProperties options. Each of these options include a subset of the functionality that strict provides.

Here is how the three options interact, as a truth table:

strict allPropertiesRequired noAdditionalProperties All Properties are Required Additional Properties are not Permitted
T * * T T
F T T T T
F T F T F
F F T F T
F F F F F

These changes are not breaking - strict behaves the same way that it did previously.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 :tada:

Comparison is base (f5071e1) 89.98% compared to head (dc25ffd) 90.00%.

:exclamation: Current head dc25ffd differs from pull request most recent head 1b844b9. Consider uploading reports for the commit 1b844b9 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #494 +/- ## ========================================== + Coverage 89.98% 90.00% +0.02% ========================================== Files 76 76 Lines 1577 1581 +4 ========================================== + Hits 1419 1423 +4 Misses 158 158 ``` | [Impacted Files](https://codecov.io/gh/voxpupuli/json-schema/pull/494?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=voxpupuli) | Coverage Δ | | |---|---|---| | [lib/json-schema/attributes/properties.rb](https://codecov.io/gh/voxpupuli/json-schema/pull/494?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=voxpupuli#diff-bGliL2pzb24tc2NoZW1hL2F0dHJpYnV0ZXMvcHJvcGVydGllcy5yYg==) | `100.00% <100.00%> (ø)` | | | [lib/json-schema/attributes/properties\_v4.rb](https://codecov.io/gh/voxpupuli/json-schema/pull/494?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=voxpupuli#diff-bGliL2pzb24tc2NoZW1hL2F0dHJpYnV0ZXMvcHJvcGVydGllc192NC5yYg==) | `100.00% <100.00%> (ø)` | | | [lib/json-schema/validator.rb](https://codecov.io/gh/voxpupuli/json-schema/pull/494?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=voxpupuli#diff-bGliL2pzb24tc2NoZW1hL3ZhbGlkYXRvci5yYg==) | `85.24% <100.00%> (+0.17%)` | :arrow_up: |

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

a-lavis commented 1 year ago

Rubocop is complaining that test/draft4_test.rb is too long - not sure what the best way to split up the class is. Any ideas?