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

🐛 Backward compatibility test: Don't fail on updating additionalProperties #15532

Merged
merged 11 commits into from
Aug 11, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def check_if_value_of_type_field_changed(self):

# Detect type value change in case type field is declared as a single item list (e.g ["str"] -> ["int"]):
type_values_changed_in_list = [
change for change in self._diff.get("values_changed", []) if change.path(output_format="list")[-2] == "type"
change
for change in self._diff.get("values_changed", [])
if len(change.path(output_format="list")) > 1 and change.path(output_format="list")[-2] == "type"
]
if type_values_changed or type_values_changed_in_list:
self._raise_error("The'type' field value was changed.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,30 @@ def as_pytest_param(self):
name="Not changing a spec should not fail",
should_fail=False,
),
Transition(
ConnectorSpecification(
connectionSpecification={
"type": "object",
"required": ["my_required_string"],
"additionalProperties": False,
"properties": {
"my_required_string": {"type": "string"},
},
}
),
ConnectorSpecification(
connectionSpecification={
"type": "object",
"required": ["my_required_string"],
"additionalProperties": True,
"properties": {
"my_required_string": {"type": "string"},
},
}
),
name="Changing the value of a boolean field should not fail",
alafanechere marked this conversation as resolved.
Show resolved Hide resolved
should_fail=False,
),
Transition(
ConnectorSpecification(
connectionSpecification={
Expand Down Expand Up @@ -898,7 +922,6 @@ def as_pytest_param(self):
# Checking that all transitions in VALID_SPEC_TRANSITIONS have should_fail = False to prevent typos
assert not all([transition.should_fail for transition in VALID_SPEC_TRANSITIONS])


ALL_SPEC_TRANSITIONS_PARAMS = [transition.as_pytest_param() for transition in FAILING_SPEC_TRANSITIONS + VALID_SPEC_TRANSITIONS]


Expand Down Expand Up @@ -1063,7 +1086,6 @@ def test_validate_previous_configs(previous_connector_spec, actual_connector_spe
# Checking that all transitions in VALID_CATALOG_TRANSITIONS have should_fail = False to prevent typos
assert not all([transition.should_fail for transition in VALID_CATALOG_TRANSITIONS])


ALL_CATALOG_TRANSITIONS_PARAMS = [transition.as_pytest_param() for transition in FAILING_CATALOG_TRANSITIONS + VALID_CATALOG_TRANSITIONS]


Expand Down