-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
SAT: all additionalProperties
fields must be set to true
#14878
Conversation
/test connector=bases/source-acceptance-test
Build PassedTest summary info:
|
I'm going to test if running test with the slash command uses a dev image of SAT and run a test for connectors that whose acceptance tests should failed on:
|
/test connector=connectors/source-openweather
Build FailedTest summary info:
|
/test connector=connectors/source-amazon-seller-partner
Build FailedTest summary info:
|
☝️ Both test failures above are expected and show that the new tests work as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job 👍🏼
There's an existing helper method that could have been used here, but I'll leave it up to you if you want to move over to that or keep the new one. My initial thought would be to use one or the other since they're so similar.
With regards to this change breaking builds for many connectors, do you know how many (python) sources are affected? We should check in with the dbs/dws team on priority for this existing issue #14718. If it will be done soon then maybe we hold off as to not impact publishes, if not then we could prioritize GA/Beta connectors and do those first.
def find_all_values_for_key_in_schema(schema: dict, searched_key: str): | ||
"""Retrieve all (nested) values in a schema for a specific searched key""" | ||
if isinstance(schema, list): | ||
for schema_item in schema: | ||
yield from find_all_values_for_key_in_schema(schema_item, searched_key) | ||
if isinstance(schema, dict): | ||
for key, value in schema.items(): | ||
if key == searched_key: | ||
yield value | ||
if isinstance(value, dict) or isinstance(value, list): | ||
yield from find_all_values_for_key_in_schema(value, searched_key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not directly equivalent since this new method retrieves all values, but the existing find_key_inside_schema
method can be used to find the first instance of a given key (e.g. find_key_inside_schema(schema, "additionalProperties")
would return {"additionalProperties": False}
or None
if not found)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I tried find_key_inside_schema
, it's indeed working but only returns the first schema item having the searched key. I could have implemented a recursion in the final test function to use this function. But I preferred to use my new function to defer the recursion to the helper to boost the readability of the test. And this function can be helpful in the future if we have other keys we want to validate value on.
@pedroslopez |
I created a list I shared in #14718 |
/test connector=connectors/source-amplitude
Build FailedTest summary info:
|
I made the required changes to beta and GA source (non-jdbc) connectors in #14924 |
/test connector=connectors/source-amplitude
Build PassedTest summary info:
|
☝️ The test above should now pass after #14924 was merged |
/publish connector=bases/source-acceptance-test auto-bump-version=false
if you have connectors that successfully published but failed definition generation, follow step 4 here |
/publish connector=bases/source-acceptance-test auto-bump-version=false
if you have connectors that successfully published but failed definition generation, follow step 4 here |
What
Closing #14600
Add tests to make sure all the connector setting the
additionalProperties
field in their spec or stream schema set the value of this field totrue
. Check #14196 to understand why this is required.How
find_all_values_for_key_in_schema
function to retrieve all the values for a specific field in a schema. (And unit test it)test_core.py
using this function to check all the values for theadditionalProperties
field aretrue
:🚨 User Impact 🚨
I think this will cause a lot of build failures because a lot of connectors are not following this rule and use
"additionalProperties" : false
.I think we also need to update our tutorials and code generation template (
*.hbs
) that are using"additionalProperties": false
. I created an issue for this.