-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[low-code cdk] Allow for spec file to be defined in the yaml manifest…
… instead of an external file (#18411) * allow for spec to be defined in the source.yaml manifest instead of an external file * make spec a component within the language to get schema validation and rework the code for better testing * fix formatting and extra method * pr feedback and add some more test * pr feedback * bump airbyte-cdk version * bump version * gradle format * remove from manifest spec
- Loading branch information
Showing
12 changed files
with
582 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
airbyte-cdk/python/airbyte_cdk/sources/declarative/spec/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
from airbyte_cdk.sources.declarative.spec.spec import Spec | ||
|
||
__all__ = ["Spec"] |
34 changes: 34 additions & 0 deletions
34
airbyte-cdk/python/airbyte_cdk/sources/declarative/spec/spec.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
from dataclasses import InitVar, dataclass | ||
from typing import Any, Mapping | ||
|
||
from airbyte_cdk.models.airbyte_protocol import ConnectorSpecification | ||
from dataclasses_jsonschema import JsonSchemaMixin | ||
|
||
|
||
@dataclass | ||
class Spec(JsonSchemaMixin): | ||
""" | ||
Returns a connection specification made up of information about the connector and how it can be configured | ||
Attributes: | ||
documentation_url (str): The link the Airbyte documentation about this connector | ||
connection_specification (Mapping[str, Any]): information related to how a connector can be configured | ||
""" | ||
|
||
documentation_url: str | ||
connection_specification: Mapping[str, Any] | ||
options: InitVar[Mapping[str, Any]] | ||
|
||
def generate_spec(self) -> ConnectorSpecification: | ||
""" | ||
Returns the connector specification according the spec block defined in the low code connector manifest. | ||
""" | ||
|
||
# We remap these keys to camel case because that's the existing format expected by the rest of the platform | ||
return ConnectorSpecification.parse_obj( | ||
{"documentationUrl": self.documentation_url, "connectionSpecification": self.connection_specification} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.