Limit add_operation_fields to fields that are expected to contain an Operation object #245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The
add_operation_fields
setting currently applies changes to all Path Item fields, not just those that are expected to contain an Operation object.One way this can fail is if you pass the
parameters
field on the Path Item object, rather than the Operation object itself, eg:This schema then fails to load:
This fixes the issue by limiting
add_operation_fields
to just fields which are expected to contain Operation objects (ie: HTTP verbs).Type of change
Checklist:
Summary by Sourcery
Limit the 'add_operation_fields' setting to only apply changes to fields expected to contain Operation objects, resolving a TypeError when non-Operation fields are modified. Add a test case to ensure correct behavior with PathItem.parameters field.
Bug Fixes:
Tests: