Skip to content

Commit 180da70

Browse files
chore: ruff format regenerated declarative_component_schema.py
1 parent 0b5cf79 commit 180da70

1 file changed

Lines changed: 61 additions & 95 deletions

File tree

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 61 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -856,18 +856,14 @@ class Scope(BaseModel):
856856
class Config:
857857
extra = Extra.allow
858858

859-
scope: str = Field(
860-
..., description="The OAuth scope string to request from the provider."
861-
)
859+
scope: str = Field(..., description="The OAuth scope string to request from the provider.")
862860

863861

864862
class OptionalScope(BaseModel):
865863
class Config:
866864
extra = Extra.allow
867865

868-
scope: str = Field(
869-
..., description="The OAuth scope string to request from the provider."
870-
)
866+
scope: str = Field(..., description="The OAuth scope string to request from the provider.")
871867

872868

873869
class ScopesJoinStrategy(Enum):
@@ -1004,28 +1000,24 @@ class OAuthConfigSpecification(BaseModel):
10041000
class Config:
10051001
extra = Extra.allow
10061002

1007-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1008-
Field(
1009-
None,
1010-
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 }",
1011-
examples=[
1012-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1013-
{
1014-
"app_id": {
1015-
"type": "string",
1016-
"path_in_connector_config": ["info", "app_id"],
1017-
}
1018-
},
1019-
],
1020-
title="OAuth user input",
1021-
)
1003+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1004+
None,
1005+
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 }",
1006+
examples=[
1007+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1008+
{
1009+
"app_id": {
1010+
"type": "string",
1011+
"path_in_connector_config": ["info", "app_id"],
1012+
}
1013+
},
1014+
],
1015+
title="OAuth user input",
10221016
)
1023-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1024-
Field(
1025-
None,
1026-
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 }',
1027-
title="DeclarativeOAuth Connector Specification",
1028-
)
1017+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1018+
None,
1019+
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 }',
1020+
title="DeclarativeOAuth Connector Specification",
10291021
)
10301022
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
10311023
None,
@@ -1043,9 +1035,7 @@ class Config:
10431035
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
10441036
None,
10451037
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 }",
1046-
examples=[
1047-
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1048-
],
1038+
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
10491039
title="OAuth input specification",
10501040
)
10511041
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1557,9 +1547,7 @@ class CustomConfigTransformation(BaseModel):
15571547
class_name: str = Field(
15581548
...,
15591549
description="Fully-qualified name of the class that will be implementing the custom config transformation. The format is `source_<name>.<package>.<class_name>`.",
1560-
examples=[
1561-
"source_declarative_manifest.components.MyCustomConfigTransformation"
1562-
],
1550+
examples=["source_declarative_manifest.components.MyCustomConfigTransformation"],
15631551
)
15641552
parameters: Optional[Dict[str, Any]] = Field(
15651553
None,
@@ -1987,9 +1975,7 @@ class OAuthAuthenticator(BaseModel):
19871975
scopes: Optional[List[str]] = Field(
19881976
None,
19891977
description="List of scopes that should be granted to the access token.",
1990-
examples=[
1991-
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
1992-
],
1978+
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
19931979
title="Scopes",
19941980
)
19951981
token_expiry_date: Optional[str] = Field(
@@ -2237,9 +2223,7 @@ class RecordSelector(BaseModel):
22372223
description="Responsible for filtering records to be emitted by the Source.",
22382224
title="Record Filter",
22392225
)
2240-
schema_normalization: Optional[
2241-
Union[SchemaNormalization, CustomSchemaNormalization]
2242-
] = Field(
2226+
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
22432227
None,
22442228
description="Responsible for normalization according to the schema.",
22452229
title="Schema Normalization",
@@ -2281,12 +2265,10 @@ class DpathValidator(BaseModel):
22812265
],
22822266
title="Field Path",
22832267
)
2284-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2285-
Field(
2286-
...,
2287-
description="The condition that the specified config value will be evaluated against",
2288-
title="Validation Strategy",
2289-
)
2268+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2269+
...,
2270+
description="The condition that the specified config value will be evaluated against",
2271+
title="Validation Strategy",
22902272
)
22912273

22922274

@@ -2303,12 +2285,10 @@ class PredicateValidator(BaseModel):
23032285
],
23042286
title="Value",
23052287
)
2306-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2307-
Field(
2308-
...,
2309-
description="The validation strategy to apply to the value.",
2310-
title="Validation Strategy",
2311-
)
2288+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2289+
...,
2290+
description="The validation strategy to apply to the value.",
2291+
title="Validation Strategy",
23122292
)
23132293

23142294

@@ -2333,12 +2313,12 @@ class ConfigAddFields(BaseModel):
23332313

23342314
class CompositeErrorHandler(BaseModel):
23352315
type: Literal["CompositeErrorHandler"]
2336-
error_handlers: List[
2337-
Union[CompositeErrorHandler, DefaultErrorHandler, CustomErrorHandler]
2338-
] = Field(
2339-
...,
2340-
description="List of error handlers to iterate on to determine how to handle a failed response.",
2341-
title="Error Handlers",
2316+
error_handlers: List[Union[CompositeErrorHandler, DefaultErrorHandler, CustomErrorHandler]] = (
2317+
Field(
2318+
...,
2319+
description="List of error handlers to iterate on to determine how to handle a failed response.",
2320+
title="Error Handlers",
2321+
)
23422322
)
23432323
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
23442324

@@ -2381,9 +2361,7 @@ class Config:
23812361
extra = Extra.allow
23822362

23832363
type: Literal["ZipfileDecoder"]
2384-
decoder: Union[
2385-
CsvDecoder, GzipDecoder, JsonDecoder, JsonItemsDecoder, JsonlDecoder
2386-
] = Field(
2364+
decoder: Union[CsvDecoder, GzipDecoder, JsonDecoder, JsonItemsDecoder, JsonlDecoder] = Field(
23872365
...,
23882366
description="Parser to parse the decompressed data from the zipfile(s).",
23892367
title="Parser",
@@ -2507,9 +2485,9 @@ class Config:
25072485

25082486
type: Literal["DeclarativeSource"]
25092487
check: Union[CheckStream, CheckDynamicStream]
2510-
streams: Optional[
2511-
List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]
2512-
] = None
2488+
streams: Optional[List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]] = (
2489+
None
2490+
)
25132491
dynamic_streams: List[DynamicDeclarativeStream]
25142492
version: str = Field(
25152493
...,
@@ -2639,20 +2617,16 @@ class Config:
26392617
extra = Extra.allow
26402618

26412619
type: Literal["DeclarativeStream"]
2642-
name: Optional[str] = Field(
2643-
"", description="The stream name.", example=["Users"], title="Name"
2644-
)
2620+
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
26452621
retriever: Union[SimpleRetriever, AsyncRetriever, CustomRetriever] = Field(
26462622
...,
26472623
description="Component used to coordinate how records are extracted across stream slices and request pages.",
26482624
title="Retriever",
26492625
)
2650-
incremental_sync: Optional[Union[DatetimeBasedCursor, IncrementingCountCursor]] = (
2651-
Field(
2652-
None,
2653-
description="Component used to fetch data incrementally based on a time field in the data.",
2654-
title="Incremental Sync",
2655-
)
2626+
incremental_sync: Optional[Union[DatetimeBasedCursor, IncrementingCountCursor]] = Field(
2627+
None,
2628+
description="Component used to fetch data incrementally based on a time field in the data.",
2629+
title="Incremental Sync",
26562630
)
26572631
primary_key: Optional[PrimaryKey] = Field("", title="Primary Key")
26582632
schema_loader: Optional[
@@ -2826,20 +2800,18 @@ class HttpRequester(BaseModelWithDeprecations):
28262800
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.",
28272801
title="Query Properties",
28282802
)
2829-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2830-
Field(
2831-
None,
2832-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2833-
examples=[
2834-
{"unit": "day"},
2835-
{
2836-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2837-
},
2838-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2839-
{"sort_by[asc]": "updated_at"},
2840-
],
2841-
title="Query Parameters",
2842-
)
2803+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2804+
None,
2805+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2806+
examples=[
2807+
{"unit": "day"},
2808+
{
2809+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2810+
},
2811+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2812+
{"sort_by[asc]": "updated_at"},
2813+
],
2814+
title="Query Parameters",
28432815
)
28442816
request_headers: Optional[Union[Dict[str, str], str]] = Field(
28452817
None,
@@ -3011,9 +2983,7 @@ class QueryProperties(BaseModel):
30112983

30122984
class StateDelegatingStream(BaseModel):
30132985
type: Literal["StateDelegatingStream"]
3014-
name: str = Field(
3015-
..., description="The stream name.", example=["Users"], title="Name"
3016-
)
2986+
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
30172987
full_refresh_stream: DeclarativeStream = Field(
30182988
...,
30192989
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -3107,17 +3077,13 @@ class AsyncRetriever(BaseModel):
31073077
status_extractor: Union[DpathExtractor, CustomRecordExtractor] = Field(
31083078
..., description="Responsible for fetching the actual status of the async job."
31093079
)
3110-
download_target_extractor: Optional[
3111-
Union[DpathExtractor, CustomRecordExtractor]
3112-
] = Field(
3080+
download_target_extractor: Optional[Union[DpathExtractor, CustomRecordExtractor]] = Field(
31133081
None,
31143082
description="Responsible for fetching the final result `urls` provided by the completed / finished / ready async job.",
31153083
)
31163084
download_extractor: Optional[
31173085
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
3118-
] = Field(
3119-
None, description="Responsible for fetching the records from provided urls."
3120-
)
3086+
] = Field(None, description="Responsible for fetching the records from provided urls.")
31213087
creation_requester: Union[HttpRequester, CustomRequester] = Field(
31223088
...,
31233089
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)