Skip to content

Commit a44f1d6

Browse files
committed
poe assemble
1 parent 1bf85a6 commit a44f1d6

File tree

1 file changed

+81
-57
lines changed

1 file changed

+81
-57
lines changed

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 81 additions & 57 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(
@@ -2005,7 +2013,9 @@ class RecordSelector(BaseModel):
20052013
description="Responsible for filtering records to be emitted by the Source.",
20062014
title="Record Filter",
20072015
)
2008-
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
2016+
schema_normalization: Optional[
2017+
Union[SchemaNormalization, CustomSchemaNormalization]
2018+
] = Field(
20092019
None,
20102020
description="Responsible for normalization according to the schema.",
20112021
title="Schema Normalization",
@@ -2041,10 +2051,12 @@ class DpathValidator(BaseModel):
20412051
],
20422052
title="Field Path",
20432053
)
2044-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2045-
...,
2046-
description="The condition that the specified config value will be evaluated against",
2047-
title="Validation Strategy",
2054+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2055+
Field(
2056+
...,
2057+
description="The condition that the specified config value will be evaluated against",
2058+
title="Validation Strategy",
2059+
)
20482060
)
20492061

20502062

@@ -2061,10 +2073,12 @@ class PredicateValidator(BaseModel):
20612073
],
20622074
title="Value",
20632075
)
2064-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2065-
...,
2066-
description="The validation strategy to apply to the value.",
2067-
title="Validation Strategy",
2076+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2077+
Field(
2078+
...,
2079+
description="The validation strategy to apply to the value.",
2080+
title="Validation Strategy",
2081+
)
20682082
)
20692083

20702084

@@ -2147,7 +2161,9 @@ class ConfigMigration(BaseModel):
21472161
description: Optional[str] = Field(
21482162
None, description="The description/purpose of the config migration."
21492163
)
2150-
transformations: List[Union[ConfigRemapField, ConfigAddFields, ConfigRemoveFields]] = Field(
2164+
transformations: List[
2165+
Union[ConfigRemapField, ConfigAddFields, ConfigRemoveFields]
2166+
] = Field(
21512167
...,
21522168
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.",
21532169
title="Transformations",
@@ -2239,9 +2255,9 @@ class Config:
22392255

22402256
type: Literal["DeclarativeSource"]
22412257
check: Union[CheckStream, CheckDynamicStream]
2242-
streams: Optional[List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]] = (
2243-
None
2244-
)
2258+
streams: Optional[
2259+
List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]
2260+
] = None
22452261
dynamic_streams: List[DynamicDeclarativeStream]
22462262
version: str = Field(
22472263
...,
@@ -2366,7 +2382,9 @@ class Config:
23662382
extra = Extra.allow
23672383

23682384
type: Literal["DeclarativeStream"]
2369-
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
2385+
name: Optional[str] = Field(
2386+
"", description="The stream name.", example=["Users"], title="Name"
2387+
)
23702388
retriever: Union[SimpleRetriever, AsyncRetriever, CustomRetriever] = Field(
23712389
...,
23722390
description="Component used to coordinate how records are extracted across stream slices and request pages.",
@@ -2544,18 +2562,20 @@ class HttpRequester(BaseModelWithDeprecations):
25442562
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.",
25452563
title="Fetch Properties from Endpoint",
25462564
)
2547-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2548-
None,
2549-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2550-
examples=[
2551-
{"unit": "day"},
2552-
{
2553-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2554-
},
2555-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2556-
{"sort_by[asc]": "updated_at"},
2557-
],
2558-
title="Query Parameters",
2565+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2566+
Field(
2567+
None,
2568+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2569+
examples=[
2570+
{"unit": "day"},
2571+
{
2572+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2573+
},
2574+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2575+
{"sort_by[asc]": "updated_at"},
2576+
],
2577+
title="Query Parameters",
2578+
)
25592579
)
25602580
request_headers: Optional[Union[Dict[str, str], str]] = Field(
25612581
None,
@@ -2676,20 +2696,15 @@ class DynamicSchemaLoader(BaseModel):
26762696

26772697
class ParentStreamConfig(BaseModel):
26782698
type: Literal["ParentStreamConfig"]
2679-
lazy_read_pointer: Optional[List[str]] = Field(
2680-
[],
2681-
description="If set, this will enable lazy reading, using the initial read of parent records to extract child records.",
2682-
title="Lazy Read Pointer",
2699+
stream: Union[DeclarativeStream, StateDelegatingStream] = Field(
2700+
..., description="Reference to the parent stream.", title="Parent Stream"
26832701
)
26842702
parent_key: str = Field(
26852703
...,
26862704
description="The primary key of records from the parent stream that will be used during the retrieval of records for the current substream. This parent identifier field is typically a characteristic of the child records being extracted from the source API.",
26872705
examples=["id", "{{ config['parent_record_id'] }}"],
26882706
title="Parent Key",
26892707
)
2690-
stream: Union[DeclarativeStream, StateDelegatingStream] = Field(
2691-
..., description="Reference to the parent stream.", title="Parent Stream"
2692-
)
26932708
partition_field: str = Field(
26942709
...,
26952710
description="While iterating over parent records during a sync, the parent_key value can be referenced by using this field.",
@@ -2706,6 +2721,11 @@ class ParentStreamConfig(BaseModel):
27062721
description="Indicates whether the parent stream should be read incrementally based on updates in the child stream.",
27072722
title="Incremental Dependency",
27082723
)
2724+
lazy_read_pointer: Optional[List[str]] = Field(
2725+
[],
2726+
description="If set, this will enable lazy reading, using the initial read of parent records to extract child records.",
2727+
title="Lazy Read Pointer",
2728+
)
27092729
extra_fields: Optional[List[List[str]]] = Field(
27102730
None,
27112731
description="Array of field paths to include as additional fields in the stream slice. Each path is an array of strings representing keys to access fields in the respective parent record. Accessible via `stream_slice.extra_fields`. Missing fields are set to `None`.",
@@ -2750,7 +2770,9 @@ class QueryProperties(BaseModel):
27502770

27512771
class StateDelegatingStream(BaseModel):
27522772
type: Literal["StateDelegatingStream"]
2753-
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
2773+
name: str = Field(
2774+
..., description="The stream name.", example=["Users"], title="Name"
2775+
)
27542776
full_refresh_stream: DeclarativeStream = Field(
27552777
...,
27562778
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2800,21 +2822,21 @@ class SimpleRetriever(BaseModel):
28002822
)
28012823
partition_router: Optional[
28022824
Union[
2803-
ListPartitionRouter,
28042825
SubstreamPartitionRouter,
2826+
ListPartitionRouter,
28052827
GroupingPartitionRouter,
28062828
CustomPartitionRouter,
28072829
List[
28082830
Union[
2809-
ListPartitionRouter,
28102831
SubstreamPartitionRouter,
2832+
ListPartitionRouter,
28112833
GroupingPartitionRouter,
28122834
CustomPartitionRouter,
28132835
]
28142836
],
28152837
]
28162838
] = Field(
2817-
[],
2839+
None,
28182840
description="PartitionRouter component that describes how to partition the stream, enabling incremental syncs and checkpointing.",
28192841
title="Partition Router",
28202842
)
@@ -2839,7 +2861,9 @@ class AsyncRetriever(BaseModel):
28392861
)
28402862
download_extractor: Optional[
28412863
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
2842-
] = Field(None, description="Responsible for fetching the records from provided urls.")
2864+
] = Field(
2865+
None, description="Responsible for fetching the records from provided urls."
2866+
)
28432867
creation_requester: Union[HttpRequester, CustomRequester] = Field(
28442868
...,
28452869
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)