Skip to content

Commit

Permalink
Make documentation_url optional in a declarative connector spec (#21347)
Browse files Browse the repository at this point in the history
* Make documentation_url optional in a declarative connector spec

* simplify if statement

* bump patch version of cdk

* Revert "bump patch version of cdk"

This reverts commit 1854bf3.

* 🤖 Bump patch version of Airbyte CDK

* Revert "🤖 Bump patch version of Airbyte CDK"

This reverts commit 85d5a98.

* 🤖 Bump patch version of Airbyte CDK

Co-authored-by: lmossman <lmossman@users.noreply.github.com>
  • Loading branch information
lmossman and lmossman authored Jan 12, 2023
1 parent 80f3c4e commit 63ff3d7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
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

0 comments on commit 63ff3d7

Please sign in to comment.