CDK: add option to source to skip config validation on read/discover (#6978)
* Add connector check_config_against_spec parameter * Bump CDK version. Add changelog record. * Always enable spec check on check cmd * Update airbyte-cdk/python/CHANGELOG.md Co-authored-by: Sherif A. Nada <snadalive@gmail.com> Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.28
|
||||
Added `check_config_against_spec` parameter to `Connector` abstract class
|
||||
to allow skipping validating the input config against the spec for non-`check` calls
|
||||
|
||||
## 0.1.27
|
||||
Improving unit test for logger
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ class AirbyteSpec(object):
|
||||
|
||||
|
||||
class Connector(ABC):
|
||||
# configure whether the `check_config_against_spec_or_exit()` needs to be called
|
||||
check_config_against_spec: bool = True
|
||||
|
||||
# can be overridden to change an input config
|
||||
def configure(self, config: Mapping[str, Any], temp_dir: str) -> Mapping[str, Any]:
|
||||
"""
|
||||
|
||||
@@ -91,7 +91,8 @@ class Destination(Connector, ABC):
|
||||
yield AirbyteMessage(type=Type.SPEC, spec=spec)
|
||||
return
|
||||
config = self.read_config(config_path=parsed_args.config)
|
||||
check_config_against_spec_or_exit(config, spec, self.logger)
|
||||
if self.check_config_against_spec or cmd == "check":
|
||||
check_config_against_spec_or_exit(config, spec, self.logger)
|
||||
|
||||
if cmd == "check":
|
||||
yield self._run_check(config=config)
|
||||
|
||||
@@ -72,7 +72,8 @@ class AirbyteEntrypoint(object):
|
||||
# Remove internal flags from config before validating so
|
||||
# jsonschema's additionalProperties flag wont fail the validation
|
||||
config, internal_config = split_config(config)
|
||||
check_config_against_spec_or_exit(config, source_spec, self.logger)
|
||||
if self.source.check_config_against_spec or cmd == "check":
|
||||
check_config_against_spec_or_exit(config, source_spec, self.logger)
|
||||
# Put internal flags back to config dict
|
||||
config.update(internal_config.dict())
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ README = (HERE / "README.md").read_text()
|
||||
|
||||
setup(
|
||||
name="airbyte-cdk",
|
||||
version="0.1.27",
|
||||
version="0.1.28",
|
||||
description="A framework for writing Airbyte Connectors.",
|
||||
long_description=README,
|
||||
long_description_content_type="text/markdown",
|
||||
|
||||
Reference in New Issue
Block a user