Skip to content

Commit 1768375

Browse files
committed
Add description and title for create_or_update
1 parent 4648550 commit 1768375

File tree

2 files changed

+69
-41
lines changed

2 files changed

+69
-41
lines changed

airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,6 +4056,8 @@ definitions:
40564056
description: The expected data type of the value. If omitted, the type will be inferred from the value provided.
40574057
"$ref": "#/definitions/ValueType"
40584058
create_or_update:
4059+
title: Create or Update
4060+
description: Determines whether to create a new path if it doesn't exist (true) or only update existing paths (false). When set to true, the resolver will create new paths in the stream template if they don't exist. When false (default), it will only update existing paths.
40594061
type: boolean
40604062
default: false
40614063
$parameters:

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,9 @@ class OAuthAuthenticator(BaseModel):
618618
scopes: Optional[List[str]] = Field(
619619
None,
620620
description="List of scopes that should be granted to the access token.",
621-
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
621+
examples=[
622+
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
623+
],
622624
title="Scopes",
623625
)
624626
token_expiry_date: Optional[str] = Field(
@@ -1124,24 +1126,28 @@ class OAuthConfigSpecification(BaseModel):
11241126
class Config:
11251127
extra = Extra.allow
11261128

1127-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1128-
None,
1129-
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 }",
1130-
examples=[
1131-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1132-
{
1133-
"app_id": {
1134-
"type": "string",
1135-
"path_in_connector_config": ["info", "app_id"],
1136-
}
1137-
},
1138-
],
1139-
title="OAuth user input",
1129+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1130+
Field(
1131+
None,
1132+
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 }",
1133+
examples=[
1134+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1135+
{
1136+
"app_id": {
1137+
"type": "string",
1138+
"path_in_connector_config": ["info", "app_id"],
1139+
}
1140+
},
1141+
],
1142+
title="OAuth user input",
1143+
)
11401144
)
1141-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1142-
None,
1143-
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 }',
1144-
title="DeclarativeOAuth Connector Specification",
1145+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1146+
Field(
1147+
None,
1148+
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 }',
1149+
title="DeclarativeOAuth Connector Specification",
1150+
)
11451151
)
11461152
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
11471153
None,
@@ -1159,7 +1165,9 @@ class Config:
11591165
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
11601166
None,
11611167
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 }",
1162-
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
1168+
examples=[
1169+
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1170+
],
11631171
title="OAuth input specification",
11641172
)
11651173
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1478,7 +1486,11 @@ class ComponentMappingDefinition(BaseModel):
14781486
description="The expected data type of the value. If omitted, the type will be inferred from the value provided.",
14791487
title="Value Type",
14801488
)
1481-
create_or_update: Optional[bool] = False
1489+
create_or_update: Optional[bool] = Field(
1490+
False,
1491+
description="Determines whether to create a new path if it doesn't exist (true) or only update existing paths (false). When set to true, the resolver will create new paths in the stream template if they don't exist. When false (default), it will only update existing paths.",
1492+
title="Create or Update",
1493+
)
14821494
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
14831495

14841496

@@ -1962,7 +1974,9 @@ class RecordSelector(BaseModel):
19621974
description="Responsible for filtering records to be emitted by the Source.",
19631975
title="Record Filter",
19641976
)
1965-
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
1977+
schema_normalization: Optional[
1978+
Union[SchemaNormalization, CustomSchemaNormalization]
1979+
] = Field(
19661980
None,
19671981
description="Responsible for normalization according to the schema.",
19681982
title="Schema Normalization",
@@ -2104,7 +2118,9 @@ class ConfigMigration(BaseModel):
21042118
description: Optional[str] = Field(
21052119
None, description="The description/purpose of the config migration."
21062120
)
2107-
transformations: List[Union[ConfigRemapField, ConfigAddFields, ConfigRemoveFields]] = Field(
2121+
transformations: List[
2122+
Union[ConfigRemapField, ConfigAddFields, ConfigRemoveFields]
2123+
] = Field(
21082124
...,
21092125
description="The list of transformations that will attempt to be applied on an incoming unmigrated config. The transformations will be applied in the order they are defined.",
21102126
title="Transformations",
@@ -2305,7 +2321,9 @@ class Config:
23052321
extra = Extra.allow
23062322

23072323
type: Literal["DeclarativeStream"]
2308-
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
2324+
name: Optional[str] = Field(
2325+
"", description="The stream name.", example=["Users"], title="Name"
2326+
)
23092327
retriever: Union[SimpleRetriever, AsyncRetriever, CustomRetriever] = Field(
23102328
...,
23112329
description="Component used to coordinate how records are extracted across stream slices and request pages.",
@@ -2483,18 +2501,20 @@ class HttpRequester(BaseModelWithDeprecations):
24832501
description="Allows for retrieving a dynamic set of properties from an API endpoint which can be injected into outbound request using the stream_partition.extra_fields.",
24842502
title="Fetch Properties from Endpoint",
24852503
)
2486-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2487-
None,
2488-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2489-
examples=[
2490-
{"unit": "day"},
2491-
{
2492-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2493-
},
2494-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2495-
{"sort_by[asc]": "updated_at"},
2496-
],
2497-
title="Query Parameters",
2504+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2505+
Field(
2506+
None,
2507+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2508+
examples=[
2509+
{"unit": "day"},
2510+
{
2511+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2512+
},
2513+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2514+
{"sort_by[asc]": "updated_at"},
2515+
],
2516+
title="Query Parameters",
2517+
)
24982518
)
24992519
request_headers: Optional[Union[Dict[str, str], str]] = Field(
25002520
None,
@@ -2689,7 +2709,9 @@ class QueryProperties(BaseModel):
26892709

26902710
class StateDelegatingStream(BaseModel):
26912711
type: Literal["StateDelegatingStream"]
2692-
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
2712+
name: str = Field(
2713+
..., description="The stream name.", example=["Users"], title="Name"
2714+
)
26932715
full_refresh_stream: DeclarativeStream = Field(
26942716
...,
26952717
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2778,7 +2800,9 @@ class AsyncRetriever(BaseModel):
27782800
)
27792801
download_extractor: Optional[
27802802
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
2781-
] = Field(None, description="Responsible for fetching the records from provided urls.")
2803+
] = Field(
2804+
None, description="Responsible for fetching the records from provided urls."
2805+
)
27822806
creation_requester: Union[HttpRequester, CustomRequester] = Field(
27832807
...,
27842808
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",
@@ -2918,10 +2942,12 @@ class DynamicDeclarativeStream(BaseModel):
29182942
stream_template: Union[DeclarativeStream, StateDelegatingStream] = Field(
29192943
..., description="Reference to the stream template.", title="Stream Template"
29202944
)
2921-
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = Field(
2922-
...,
2923-
description="Component resolve and populates stream templates with components values.",
2924-
title="Components Resolver",
2945+
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = (
2946+
Field(
2947+
...,
2948+
description="Component resolve and populates stream templates with components values.",
2949+
title="Components Resolver",
2950+
)
29252951
)
29262952

29272953

0 commit comments

Comments
 (0)