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

Allow extra configs so tools built on top of bravado-core can use them #274

Merged
merged 1 commit into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions bravado_core/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,13 @@ def __init__(self, spec_dict, origin_url=None, http_client=None,
def _validate_config(self):
"""
Validates the correctness of the configurations injected and makes sure that:
- no extra config keys are available on the config dictionary
- dependent configs are checked

:return: True if the initial configs are valid, False otherwise
:rtype: bool
"""
are_config_changed = False

extraneous_keys = set(iterkeys(self.config)) - set(iterkeys(CONFIG_DEFAULTS))
if extraneous_keys:
are_config_changed = True
for key in extraneous_keys:
warnings.warn(
message='config {} is not a recognized config key'.format(key),
category=Warning,
)

if self.config['internally_dereference_refs'] and not self.config['validate_swagger_spec']:
are_config_changed = True
self.config['internally_dereference_refs'] = False
Expand Down
5 changes: 0 additions & 5 deletions tests/spec/validate_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ def test_validate_config_succeed(minimal_swagger_dict, minimal_swagger_abspath,
@pytest.mark.parametrize(
'config, expected_different_config, expected_warnings_call',
[
(
{'this_is_an_extra_key': True},
False,
'config this_is_an_extra_key is not a recognized config key',
),
(
{'validate_swagger_spec': False, 'internally_dereference_refs': True},
True,
Expand Down