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

Make documentation_url optional in a declarative connector spec #21347

Merged
merged 8 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airbyte-cdk/python/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.19.0
current_version = 0.19.1
commit = False

[bumpversion:file:setup.py]
3 changes: 3 additions & 0 deletions airbyte-cdk/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.19.1
Low-code: Make documentation_url in the Spec be optional

## 0.19.0
Low-Code: Handle forward references in manifest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,6 @@ definitions:
required:
- type
- connection_specification
- documentation_url
properties:
type:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class SingleSlice(BaseModel):
class Spec(BaseModel):
type: Literal["Spec"]
connection_specification: Dict[str, Any]
documentation_url: str
documentation_url: Optional[str] = None


class WaitTimeFromHeader(BaseModel):
Expand Down
15 changes: 9 additions & 6 deletions airbyte-cdk/python/airbyte_cdk/sources/declarative/spec/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

from dataclasses import InitVar, dataclass
from typing import Any, Mapping
from typing import Any, Mapping, Optional

from airbyte_cdk.models.airbyte_protocol import ConnectorSpecification
from dataclasses_jsonschema import JsonSchemaMixin
Expand All @@ -15,20 +15,23 @@ 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 (Optional[str]): The link the Airbyte documentation about this connector
"""

documentation_url: str
connection_specification: Mapping[str, Any]
options: InitVar[Mapping[str, Any]]
documentation_url: Optional[str] = None

def generate_spec(self) -> ConnectorSpecification:
"""
Returns the connector specification according the spec block defined in the low code connector manifest.
"""

obj = {"connectionSpecification": self.connection_specification}

if self.documentation_url:
obj["documentationUrl"] = self.documentation_url

# 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}
)
return ConnectorSpecification.parse_obj(obj)
2 changes: 1 addition & 1 deletion airbyte-cdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="airbyte-cdk",
version="0.19.0",
version="0.19.1",
description="A framework for writing Airbyte Connectors.",
long_description=README,
long_description_content_type="text/markdown",
Expand Down