Skip to content

Commit 042a18b

Browse files
feat(cdk): improve connector builder field descriptions and examples
- Enhanced Field() annotations for authentication components (ApiKeyAuthenticator, BearerAuthenticator, etc.) - Improved pagination strategy descriptions and examples (CursorPagination, OffsetIncrement, PageIncrement) - Added better examples and descriptions for incremental sync components (DatetimeBasedCursor) - Enhanced record processing component descriptions (RecordSelector, DpathExtractor, validators) - Improved stream configuration field descriptions and examples - Added realistic examples with interpolation syntax for better user guidance - Regenerated declarative_component_schema.yaml from updated Pydantic models These improvements enhance the Connector Builder UI helper tooltips to provide more user-friendly guidance and examples for configuring connectors. Co-Authored-By: AJ Steers <[email protected]>
1 parent e4cbaaf commit 042a18b

File tree

1 file changed

+71
-49
lines changed

1 file changed

+71
-49
lines changed

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 71 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2-
31
# generated by datamodel-codegen:
42
# filename: declarative_component_schema.yaml
53

@@ -623,7 +621,9 @@ class OAuthAuthenticator(BaseModel):
623621
scopes: Optional[List[str]] = Field(
624622
None,
625623
description="List of scopes that should be granted to the access token.",
626-
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
624+
examples=[
625+
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
626+
],
627627
title="Scopes",
628628
)
629629
token_expiry_date: Optional[str] = Field(
@@ -1134,24 +1134,28 @@ class OAuthConfigSpecification(BaseModel):
11341134
class Config:
11351135
extra = Extra.allow
11361136

1137-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1138-
None,
1139-
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 }",
1140-
examples=[
1141-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1142-
{
1143-
"app_id": {
1144-
"type": "string",
1145-
"path_in_connector_config": ["info", "app_id"],
1146-
}
1147-
},
1148-
],
1149-
title="OAuth user input",
1137+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1138+
Field(
1139+
None,
1140+
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 }",
1141+
examples=[
1142+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1143+
{
1144+
"app_id": {
1145+
"type": "string",
1146+
"path_in_connector_config": ["info", "app_id"],
1147+
}
1148+
},
1149+
],
1150+
title="OAuth user input",
1151+
)
11501152
)
1151-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1152-
None,
1153-
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 }',
1154-
title="DeclarativeOAuth Connector Specification",
1153+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1154+
Field(
1155+
None,
1156+
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 }',
1157+
title="DeclarativeOAuth Connector Specification",
1158+
)
11551159
)
11561160
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
11571161
None,
@@ -1169,7 +1173,9 @@ class Config:
11691173
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
11701174
None,
11711175
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 }",
1172-
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
1176+
examples=[
1177+
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1178+
],
11731179
title="OAuth input specification",
11741180
)
11751181
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1665,7 +1671,9 @@ class CustomConfigTransformation(BaseModel):
16651671
class_name: str = Field(
16661672
...,
16671673
description="Fully-qualified name of the class that will be implementing the custom config transformation. The format is `source_<name>.<package>.<class_name>`.",
1668-
examples=["source_declarative_manifest.components.MyCustomConfigTransformation"],
1674+
examples=[
1675+
"source_declarative_manifest.components.MyCustomConfigTransformation"
1676+
],
16691677
)
16701678
parameters: Optional[Dict[str, Any]] = Field(
16711679
None,
@@ -2050,7 +2058,9 @@ class RecordSelector(BaseModel):
20502058
description="Responsible for filtering records to be emitted by the Source.",
20512059
title="Record Filter",
20522060
)
2053-
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
2061+
schema_normalization: Optional[
2062+
Union[SchemaNormalization, CustomSchemaNormalization]
2063+
] = Field(
20542064
None,
20552065
description="Responsible for normalization according to the schema.",
20562066
title="Schema Normalization",
@@ -2086,10 +2096,12 @@ class DpathValidator(BaseModel):
20862096
],
20872097
title="Field Path",
20882098
)
2089-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2090-
...,
2091-
description="The condition that the specified config value will be evaluated against",
2092-
title="Validation Strategy",
2099+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2100+
Field(
2101+
...,
2102+
description="The condition that the specified config value will be evaluated against",
2103+
title="Validation Strategy",
2104+
)
20932105
)
20942106

20952107

@@ -2106,10 +2118,12 @@ class PredicateValidator(BaseModel):
21062118
],
21072119
title="Value",
21082120
)
2109-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2110-
...,
2111-
description="The validation strategy to apply to the value.",
2112-
title="Validation Strategy",
2121+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2122+
Field(
2123+
...,
2124+
description="The validation strategy to apply to the value.",
2125+
title="Validation Strategy",
2126+
)
21132127
)
21142128

21152129

@@ -2299,9 +2313,9 @@ class Config:
22992313

23002314
type: Literal["DeclarativeSource"]
23012315
check: Union[CheckStream, CheckDynamicStream]
2302-
streams: Optional[List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]] = (
2303-
None
2304-
)
2316+
streams: Optional[
2317+
List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]
2318+
] = None
23052319
dynamic_streams: List[DynamicDeclarativeStream]
23062320
version: str = Field(
23072321
...,
@@ -2426,7 +2440,9 @@ class Config:
24262440
extra = Extra.allow
24272441

24282442
type: Literal["DeclarativeStream"]
2429-
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
2443+
name: Optional[str] = Field(
2444+
"", description="The stream name.", example=["Users"], title="Name"
2445+
)
24302446
retriever: Union[SimpleRetriever, AsyncRetriever, CustomRetriever] = Field(
24312447
...,
24322448
description="Component used to coordinate how records are extracted across stream slices and request pages.",
@@ -2611,18 +2627,20 @@ class HttpRequester(BaseModelWithDeprecations):
26112627
description="For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.",
26122628
title="Query Properties",
26132629
)
2614-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2615-
None,
2616-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2617-
examples=[
2618-
{"unit": "day"},
2619-
{
2620-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2621-
},
2622-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2623-
{"sort_by[asc]": "updated_at"},
2624-
],
2625-
title="Query Parameters",
2630+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2631+
Field(
2632+
None,
2633+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2634+
examples=[
2635+
{"unit": "day"},
2636+
{
2637+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2638+
},
2639+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2640+
{"sort_by[asc]": "updated_at"},
2641+
],
2642+
title="Query Parameters",
2643+
)
26262644
)
26272645
request_headers: Optional[Union[Dict[str, str], str]] = Field(
26282646
None,
@@ -2789,7 +2807,9 @@ class QueryProperties(BaseModel):
27892807

27902808
class StateDelegatingStream(BaseModel):
27912809
type: Literal["StateDelegatingStream"]
2792-
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
2810+
name: str = Field(
2811+
..., description="The stream name.", example=["Users"], title="Name"
2812+
)
27932813
full_refresh_stream: DeclarativeStream = Field(
27942814
...,
27952815
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2878,7 +2898,9 @@ class AsyncRetriever(BaseModel):
28782898
)
28792899
download_extractor: Optional[
28802900
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
2881-
] = Field(None, description="Responsible for fetching the records from provided urls.")
2901+
] = Field(
2902+
None, description="Responsible for fetching the records from provided urls."
2903+
)
28822904
creation_requester: Union[HttpRequester, CustomRequester] = Field(
28832905
...,
28842906
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",

0 commit comments

Comments
 (0)