Skip to content

Commit f323849

Browse files
committed
improve language detection
1 parent f7e4ddf commit f323849

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

airbyte_cdk/models/connector_metadata.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,29 @@ class ConnectorMetadata(BaseModel):
4242

4343
dockerRepository: str = Field(..., description="Docker repository for the connector image")
4444
dockerImageTag: str = Field(..., description="Docker image tag for the connector")
45-
language: ConnectorLanguage | None = Field(
46-
None, description="Language of the connector implementation"
45+
46+
tags: list[str] = Field(
47+
default=[],
48+
description="List of tags for the connector",
4749
)
50+
51+
@property
52+
def language(self) -> ConnectorLanguage:
53+
"""Get the connector language."""
54+
for tag in self.tags:
55+
if tag.startswith("language:"):
56+
language = tag.split(":", 1)[1]
57+
if language == "python":
58+
return ConnectorLanguage.PYTHON
59+
elif language == "java":
60+
return ConnectorLanguage.JAVA
61+
elif language == "low-code":
62+
return ConnectorLanguage.LOW_CODE
63+
elif language == "manifest-only":
64+
return ConnectorLanguage.MANIFEST_ONLY
65+
66+
return ConnectorLanguage.UNKNOWN
67+
4868
connectorBuildOptions: ConnectorBuildOptions | None = Field(
4969
None, description="Options for building the connector"
5070
)

0 commit comments

Comments
 (0)