Skip to content

Commit 6e79ecf

Browse files
committed
make csvdecoder available
1 parent 2316567 commit 6e79ecf

File tree

2 files changed

+38
-58
lines changed

2 files changed

+38
-58
lines changed

airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,6 +2984,7 @@ definitions:
29842984
description: Component decoding the response so records can be extracted.
29852985
anyOf:
29862986
- "$ref": "#/definitions/CustomDecoder"
2987+
- "$ref": "#/definitions/CsvDecoder"
29872988
- "$ref": "#/definitions/JsonDecoder"
29882989
- "$ref": "#/definitions/JsonlDecoder"
29892990
- "$ref": "#/definitions/IterableDecoder"
@@ -3142,6 +3143,7 @@ definitions:
31423143
description: Component decoding the response so records can be extracted.
31433144
anyOf:
31443145
- "$ref": "#/definitions/CustomDecoder"
3146+
- "$ref": "#/definitions/CsvDecoder"
31453147
- "$ref": "#/definitions/JsonDecoder"
31463148
- "$ref": "#/definitions/JsonlDecoder"
31473149
- "$ref": "#/definitions/IterableDecoder"
@@ -3152,6 +3154,7 @@ definitions:
31523154
description: Component decoding the download response so records can be extracted.
31533155
anyOf:
31543156
- "$ref": "#/definitions/CustomDecoder"
3157+
- "$ref": "#/definitions/CsvDecoder"
31553158
- "$ref": "#/definitions/JsonDecoder"
31563159
- "$ref": "#/definitions/JsonlDecoder"
31573160
- "$ref": "#/definitions/IterableDecoder"

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 35 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,7 @@ class OAuthAuthenticator(BaseModel):
609609
scopes: Optional[List[str]] = Field(
610610
None,
611611
description="List of scopes that should be granted to the access token.",
612-
examples=[
613-
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
614-
],
612+
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
615613
title="Scopes",
616614
)
617615
token_expiry_date: Optional[str] = Field(
@@ -1038,28 +1036,24 @@ class OAuthConfigSpecification(BaseModel):
10381036
class Config:
10391037
extra = Extra.allow
10401038

1041-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1042-
Field(
1043-
None,
1044-
description="OAuth specific blob. This is a Json Schema used to validate Json configurations used as input to OAuth.\nMust be a valid non-nested JSON that refers to properties from ConnectorSpecification.connectionSpecification\nusing special annotation 'path_in_connector_config'.\nThese are input values the user is entering through the UI to authenticate to the connector, that might also shared\nas inputs for syncing data via the connector.\nExamples:\nif no connector values is shared during oauth flow, oauth_user_input_from_connector_config_specification=[]\nif connector values such as 'app_id' inside the top level are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['app_id']\n }\n }\nif connector values such as 'info.app_id' nested inside another object are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['info', 'app_id']\n }\n }",
1045-
examples=[
1046-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1047-
{
1048-
"app_id": {
1049-
"type": "string",
1050-
"path_in_connector_config": ["info", "app_id"],
1051-
}
1052-
},
1053-
],
1054-
title="OAuth user input",
1055-
)
1039+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1040+
None,
1041+
description="OAuth specific blob. This is a Json Schema used to validate Json configurations used as input to OAuth.\nMust be a valid non-nested JSON that refers to properties from ConnectorSpecification.connectionSpecification\nusing special annotation 'path_in_connector_config'.\nThese are input values the user is entering through the UI to authenticate to the connector, that might also shared\nas inputs for syncing data via the connector.\nExamples:\nif no connector values is shared during oauth flow, oauth_user_input_from_connector_config_specification=[]\nif connector values such as 'app_id' inside the top level are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['app_id']\n }\n }\nif connector values such as 'info.app_id' nested inside another object are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['info', 'app_id']\n }\n }",
1042+
examples=[
1043+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1044+
{
1045+
"app_id": {
1046+
"type": "string",
1047+
"path_in_connector_config": ["info", "app_id"],
1048+
}
1049+
},
1050+
],
1051+
title="OAuth user input",
10561052
)
1057-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1058-
Field(
1059-
None,
1060-
description='The DeclarativeOAuth specific blob.\nPertains to the fields defined by the connector relating to the OAuth flow.\n\nInterpolation capabilities:\n- The variables placeholders are declared as `{{my_var}}`.\n- The nested resolution variables like `{{ {{my_nested_var}} }}` is allowed as well.\n\n- The allowed interpolation context is:\n + base64Encoder - encode to `base64`, {{ {{my_var_a}}:{{my_var_b}} | base64Encoder }}\n + base64Decorer - decode from `base64` encoded string, {{ {{my_string_variable_or_string_value}} | base64Decoder }}\n + urlEncoder - encode the input string to URL-like format, {{ https://test.host.com/endpoint | urlEncoder}}\n + urlDecorer - decode the input url-encoded string into text format, {{ urlDecoder:https%3A%2F%2Fairbyte.io | urlDecoder}}\n + codeChallengeS256 - get the `codeChallenge` encoded value to provide additional data-provider specific authorisation values, {{ {{state_value}} | codeChallengeS256 }}\n\nExamples:\n - The TikTok Marketing DeclarativeOAuth spec:\n {\n "oauth_connector_input_specification": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "consent_url": "https://ads.tiktok.com/marketing_api/auth?{{client_id_key}}={{client_id_value}}&{{redirect_uri_key}}={{ {{redirect_uri_value}} | urlEncoder}}&{{state_key}}={{state_value}}",\n "access_token_url": "https://business-api.tiktok.com/open_api/v1.3/oauth2/access_token/",\n "access_token_params": {\n "{{ auth_code_key }}": "{{ auth_code_value }}",\n "{{ client_id_key }}": "{{ client_id_value }}",\n "{{ client_secret_key }}": "{{ client_secret_value }}"\n },\n "access_token_headers": {\n "Content-Type": "application/json",\n "Accept": "application/json"\n },\n "extract_output": ["data.access_token"],\n "client_id_key": "app_id",\n "client_secret_key": "secret",\n "auth_code_key": "auth_code"\n }\n }\n }',
1061-
title="DeclarativeOAuth Connector Specification",
1062-
)
1053+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1054+
None,
1055+
description='The DeclarativeOAuth specific blob.\nPertains to the fields defined by the connector relating to the OAuth flow.\n\nInterpolation capabilities:\n- The variables placeholders are declared as `{{my_var}}`.\n- The nested resolution variables like `{{ {{my_nested_var}} }}` is allowed as well.\n\n- The allowed interpolation context is:\n + base64Encoder - encode to `base64`, {{ {{my_var_a}}:{{my_var_b}} | base64Encoder }}\n + base64Decorer - decode from `base64` encoded string, {{ {{my_string_variable_or_string_value}} | base64Decoder }}\n + urlEncoder - encode the input string to URL-like format, {{ https://test.host.com/endpoint | urlEncoder}}\n + urlDecorer - decode the input url-encoded string into text format, {{ urlDecoder:https%3A%2F%2Fairbyte.io | urlDecoder}}\n + codeChallengeS256 - get the `codeChallenge` encoded value to provide additional data-provider specific authorisation values, {{ {{state_value}} | codeChallengeS256 }}\n\nExamples:\n - The TikTok Marketing DeclarativeOAuth spec:\n {\n "oauth_connector_input_specification": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "consent_url": "https://ads.tiktok.com/marketing_api/auth?{{client_id_key}}={{client_id_value}}&{{redirect_uri_key}}={{ {{redirect_uri_value}} | urlEncoder}}&{{state_key}}={{state_value}}",\n "access_token_url": "https://business-api.tiktok.com/open_api/v1.3/oauth2/access_token/",\n "access_token_params": {\n "{{ auth_code_key }}": "{{ auth_code_value }}",\n "{{ client_id_key }}": "{{ client_id_value }}",\n "{{ client_secret_key }}": "{{ client_secret_value }}"\n },\n "access_token_headers": {\n "Content-Type": "application/json",\n "Accept": "application/json"\n },\n "extract_output": ["data.access_token"],\n "client_id_key": "app_id",\n "client_secret_key": "secret",\n "auth_code_key": "auth_code"\n }\n }\n }',
1056+
title="DeclarativeOAuth Connector Specification",
10631057
)
10641058
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
10651059
None,
@@ -1077,9 +1071,7 @@ class Config:
10771071
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
10781072
None,
10791073
description="OAuth specific blob. This is a Json Schema used to validate Json configurations persisted as Airbyte Server configurations.\nMust be a valid non-nested JSON describing additional fields configured by the Airbyte Instance or Workspace Admins to be used by the\nserver when completing an OAuth flow (typically exchanging an auth code for refresh token).\nExamples:\n complete_oauth_server_input_specification={\n client_id: {\n type: string\n },\n client_secret: {\n type: string\n }\n }",
1080-
examples=[
1081-
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1082-
],
1074+
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
10831075
title="OAuth input specification",
10841076
)
10851077
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1661,9 +1653,7 @@ class RecordSelector(BaseModel):
16611653
description="Responsible for filtering records to be emitted by the Source.",
16621654
title="Record Filter",
16631655
)
1664-
schema_normalization: Optional[
1665-
Union[SchemaNormalization, CustomSchemaNormalization]
1666-
] = Field(
1656+
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
16671657
SchemaNormalization.None_,
16681658
description="Responsible for normalization according to the schema.",
16691659
title="Schema Normalization",
@@ -1832,16 +1822,12 @@ class Config:
18321822
description="Component used to coordinate how records are extracted across stream slices and request pages.",
18331823
title="Retriever",
18341824
)
1835-
incremental_sync: Optional[Union[CustomIncrementalSync, DatetimeBasedCursor]] = (
1836-
Field(
1837-
None,
1838-
description="Component used to fetch data incrementally based on a time field in the data.",
1839-
title="Incremental Sync",
1840-
)
1841-
)
1842-
name: Optional[str] = Field(
1843-
"", description="The stream name.", example=["Users"], title="Name"
1825+
incremental_sync: Optional[Union[CustomIncrementalSync, DatetimeBasedCursor]] = Field(
1826+
None,
1827+
description="Component used to fetch data incrementally based on a time field in the data.",
1828+
title="Incremental Sync",
18441829
)
1830+
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
18451831
primary_key: Optional[PrimaryKey] = Field(
18461832
"", description="The primary key of the stream.", title="Primary Key"
18471833
)
@@ -2113,11 +2099,7 @@ class SimpleRetriever(BaseModel):
21132099
CustomPartitionRouter,
21142100
ListPartitionRouter,
21152101
SubstreamPartitionRouter,
2116-
List[
2117-
Union[
2118-
CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter
2119-
]
2120-
],
2102+
List[Union[CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter]],
21212103
]
21222104
] = Field(
21232105
[],
@@ -2127,6 +2109,7 @@ class SimpleRetriever(BaseModel):
21272109
decoder: Optional[
21282110
Union[
21292111
CustomDecoder,
2112+
CsvDecoder,
21302113
JsonDecoder,
21312114
JsonlDecoder,
21322115
IterableDecoder,
@@ -2159,9 +2142,7 @@ class AsyncRetriever(BaseModel):
21592142
)
21602143
download_extractor: Optional[
21612144
Union[CustomRecordExtractor, DpathExtractor, ResponseToFileExtractor]
2162-
] = Field(
2163-
None, description="Responsible for fetching the records from provided urls."
2164-
)
2145+
] = Field(None, description="Responsible for fetching the records from provided urls.")
21652146
creation_requester: Union[CustomRequester, HttpRequester] = Field(
21662147
...,
21672148
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",
@@ -2195,11 +2176,7 @@ class AsyncRetriever(BaseModel):
21952176
CustomPartitionRouter,
21962177
ListPartitionRouter,
21972178
SubstreamPartitionRouter,
2198-
List[
2199-
Union[
2200-
CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter
2201-
]
2202-
],
2179+
List[Union[CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter]],
22032180
]
22042181
] = Field(
22052182
[],
@@ -2209,6 +2186,7 @@ class AsyncRetriever(BaseModel):
22092186
decoder: Optional[
22102187
Union[
22112188
CustomDecoder,
2189+
CsvDecoder,
22122190
JsonDecoder,
22132191
JsonlDecoder,
22142192
IterableDecoder,
@@ -2223,6 +2201,7 @@ class AsyncRetriever(BaseModel):
22232201
download_decoder: Optional[
22242202
Union[
22252203
CustomDecoder,
2204+
CsvDecoder,
22262205
JsonDecoder,
22272206
JsonlDecoder,
22282207
IterableDecoder,
@@ -2263,12 +2242,10 @@ class DynamicDeclarativeStream(BaseModel):
22632242
stream_template: DeclarativeStream = Field(
22642243
..., description="Reference to the stream template.", title="Stream Template"
22652244
)
2266-
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = (
2267-
Field(
2268-
...,
2269-
description="Component resolve and populates stream templates with components values.",
2270-
title="Components Resolver",
2271-
)
2245+
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = Field(
2246+
...,
2247+
description="Component resolve and populates stream templates with components values.",
2248+
title="Components Resolver",
22722249
)
22732250

22742251

0 commit comments

Comments
 (0)