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

Disable additional properties for majority of schemas in API #152

Merged
merged 1 commit into from
Mar 19, 2023

Conversation

ghost
Copy link

@ghost ghost commented Mar 17, 2023

Description

By disabling additional properties in the API it ensures that if someone sends a property that we don't understand the API server responds with a 400 error.

This is particularly useful if you make a spelling mistake when crafting an API request because the mispelled field will result in an error instead of being accepted and ignored as an addtional property.

The only schemas which can't have additionalProperties disabled are common schemas which are included in "allOf" statements, that add additional fields by combining schemas. Instead additionalProperties: false is added to the combined schema instead.

Type of Change

[X] Bug Fix
[ ] New Feature
[ ] Breaking Change
[ ] Refactor
[ ] Documentation
[ ] Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@ghost ghost self-requested a review as a code owner March 17, 2023 12:30
FrimIdan
FrimIdan previously approved these changes Mar 19, 2023
By disabling additional properties in the API it ensures that if someone
sends a property that we don't understand the API server responds with a
400 error.

This is particularly useful if you make a spelling mistake when crafting
an API request because the mispelled field will result in an error
instead of being accepted and ignored as an addtional property.

The only schemas which can't have additionalProperties disabled are
common schemas which are included in "allOf" statements, that add
additional fields by combining schemas. Instead additionalProperties: false
is added to the combined schema instead.
@FrimIdan FrimIdan merged commit fcb350c into main Mar 19, 2023
@FrimIdan FrimIdan deleted the block_additional_properties branch March 19, 2023 10:01
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.

None yet

3 participants