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

feat: introduce flag noAdditionalProperties #97

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

pascal-hofmann
Copy link
Contributor

This will default additionalProperties to false for all objects in the schema if set to true. The additionalProperties annotation, schemaRoot.additionalProperties and additionalProperties set via other ways (nested in itemProperties, patternProperties or similar) will take precedence over this setting, so it's fully backwards compatible.

Closes #95.

@pascal-hofmann pascal-hofmann marked this pull request as draft October 24, 2024 14:38
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.08%. Comparing base (f259920) to head (b7c3e74).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #97      +/-   ##
==========================================
+ Coverage   99.06%   99.08%   +0.02%     
==========================================
  Files           6        6              
  Lines         639      653      +14     
==========================================
+ Hits          633      647      +14     
  Misses          4        4              
  Partials        2        2              
Flag Coverage Δ
unittests 99.08% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pascal-hofmann pascal-hofmann force-pushed the feat/noAdditionalProperties branch 2 times, most recently from 9cfee26 to 5239364 Compare October 24, 2024 15:00
@pascal-hofmann pascal-hofmann marked this pull request as ready for review October 24, 2024 15:03
@pascal-hofmann
Copy link
Contributor Author

pascal-hofmann commented Oct 24, 2024

I'll add a testcase that increases the coverage of parser.go.

This will default `additionalProperties` to `false` for all objects in the schema if set to `true`.
The `additionalProperties` annotation, `schemaRoot.additionalProperties` and additionalProperties
set via other ways (nested in `itemProperties`, `patternProperties` or similar) will take
precedence over this setting, so it's fully backwards compatible.

Closes losisin#95.
@pascal-hofmann
Copy link
Contributor Author

Coverage should be fine now.

Copy link
Owner

@losisin losisin left a comment

Choose a reason for hiding this comment

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

awesome

@losisin losisin merged commit dd6ce63 into losisin:main Oct 24, 2024
3 checks passed
@pascal-hofmann pascal-hofmann deleted the feat/noAdditionalProperties branch October 24, 2024 17:36
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.

setting additionalProperties recursive
2 participants