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

SAT: Add validation of data types in the output records #3253 #4345

Merged
merged 11 commits into from
Jul 5, 2021

Conversation

keu
Copy link
Contributor

@keu keu commented Jun 25, 2021

What

added new config option validate_schema to basic_read test (ON by default).

How

Describe the solution

@keu keu requested a review from htrueman June 25, 2021 14:25
@keu keu linked an issue Jun 25, 2021 that may be closed by this pull request
Copy link
Contributor

@htrueman htrueman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a few small comments.

## 0.1.6
Add configurable validation of schema for all records in BasicRead test: https://github.com/airbytehq/airbyte/pull/4345
The validation is ON by default.
To disable validation for the source you need to set `validate_schema: off` in the config file.
Copy link
Contributor

@htrueman htrueman Jun 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps validate_schema: false ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be on, so we will introduce this aggressively and then fix tests for specific connectors. In this way, we will ensure that new connectors follow best practices from the begining.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you mean that off should be false instead, then it is pydantic feature to encode boolean as true, 1, on, yes...
https://pydantic-docs.helpmanual.io/usage/types/#booleans

Comment on lines +47 to +58
def test_required(self):
"""Check that connector will fail if any required field is missing"""

def test_optional(self):
"""Check that connector can work without any optional field"""

def test_has_secret(self):
"""Check that spec has a secret. Not sure if this should be always the case"""

def test_secret_never_in_the_output(self):
"""This test should be injected into any docker command it needs to know current config and spec"""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these empty tests in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is gonna hurt, just documented future tests. I've used tests to document the idea, instead of documenting this as part of the ticket.

…tance_test/tests/test_core.py

Co-authored-by: Vadym <vege1wgw@gmail.com>
@keu keu requested a review from sherifnada June 30, 2021 22:07
from jsonschema import Draft4Validator, ValidationError


def verify_records_schema(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to start doing this at some point so no time like the present...

could we write a unit test for this functionality?

@sherifnada
Copy link
Contributor

also pls make sure to update the PR title and formatting

@keu keu changed the title SAT: should validate the data types of output records #3253 SAT: Add validate of data types in the output records #3253 Jun 30, 2021
@keu keu changed the title SAT: Add validate of data types in the output records #3253 SAT: Add validation of data types in the output records #3253 Jul 5, 2021
@keu
Copy link
Contributor Author

keu commented Jul 5, 2021

/publish connector=base/source-acceptance-test

❌ base/source-acceptance-test https://github.com/airbytehq/airbyte/actions/runs/1002406983

@keu
Copy link
Contributor Author

keu commented Jul 5, 2021

/publish connector=bases/source-acceptance-test

🕑 bases/source-acceptance-test https://github.com/airbytehq/airbyte/actions/runs/1002422275
✅ bases/source-acceptance-test https://github.com/airbytehq/airbyte/actions/runs/1002422275

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Jul 5, 2021
@keu keu merged commit 15c8f8a into master Jul 5, 2021
@keu keu deleted the keu/sat-verify-records-schema branch July 5, 2021 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SAT: should validate the data types of output records
4 participants