Skip to content

Commit 499d3ee

Browse files
style: fix ruff formatting in generated models
Co-Authored-By: aldo.gonzalez@airbyte.io <aldo.gonzalez@airbyte.io>
1 parent 65927ec commit 499d3ee

1 file changed

Lines changed: 58 additions & 86 deletions

File tree

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 58 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -926,28 +926,24 @@ class OAuthConfigSpecification(BaseModel):
926926
class Config:
927927
extra = Extra.allow
928928

929-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
930-
Field(
931-
None,
932-
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 }",
933-
examples=[
934-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
935-
{
936-
"app_id": {
937-
"type": "string",
938-
"path_in_connector_config": ["info", "app_id"],
939-
}
940-
},
941-
],
942-
title="OAuth user input",
943-
)
929+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
930+
None,
931+
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 }",
932+
examples=[
933+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
934+
{
935+
"app_id": {
936+
"type": "string",
937+
"path_in_connector_config": ["info", "app_id"],
938+
}
939+
},
940+
],
941+
title="OAuth user input",
944942
)
945-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
946-
Field(
947-
None,
948-
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 }',
949-
title="DeclarativeOAuth Connector Specification",
950-
)
943+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
944+
None,
945+
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 }',
946+
title="DeclarativeOAuth Connector Specification",
951947
)
952948
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
953949
None,
@@ -965,9 +961,7 @@ class Config:
965961
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
966962
None,
967963
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 }",
968-
examples=[
969-
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
970-
],
964+
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
971965
title="OAuth input specification",
972966
)
973967
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1471,9 +1465,7 @@ class CustomConfigTransformation(BaseModel):
14711465
class_name: str = Field(
14721466
...,
14731467
description="Fully-qualified name of the class that will be implementing the custom config transformation. The format is `source_<name>.<package>.<class_name>`.",
1474-
examples=[
1475-
"source_declarative_manifest.components.MyCustomConfigTransformation"
1476-
],
1468+
examples=["source_declarative_manifest.components.MyCustomConfigTransformation"],
14771469
)
14781470
parameters: Optional[Dict[str, Any]] = Field(
14791471
None,
@@ -1901,9 +1893,7 @@ class OAuthAuthenticator(BaseModel):
19011893
scopes: Optional[List[str]] = Field(
19021894
None,
19031895
description="List of scopes that should be granted to the access token.",
1904-
examples=[
1905-
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
1906-
],
1896+
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
19071897
title="Scopes",
19081898
)
19091899
token_expiry_date: Optional[str] = Field(
@@ -2125,9 +2115,7 @@ class RecordSelector(BaseModel):
21252115
description="Responsible for filtering records to be emitted by the Source.",
21262116
title="Record Filter",
21272117
)
2128-
schema_normalization: Optional[
2129-
Union[SchemaNormalization, CustomSchemaNormalization]
2130-
] = Field(
2118+
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
21312119
None,
21322120
description="Responsible for normalization according to the schema.",
21332121
title="Schema Normalization",
@@ -2169,12 +2157,10 @@ class DpathValidator(BaseModel):
21692157
],
21702158
title="Field Path",
21712159
)
2172-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2173-
Field(
2174-
...,
2175-
description="The condition that the specified config value will be evaluated against",
2176-
title="Validation Strategy",
2177-
)
2160+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2161+
...,
2162+
description="The condition that the specified config value will be evaluated against",
2163+
title="Validation Strategy",
21782164
)
21792165

21802166

@@ -2191,12 +2177,10 @@ class PredicateValidator(BaseModel):
21912177
],
21922178
title="Value",
21932179
)
2194-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2195-
Field(
2196-
...,
2197-
description="The validation strategy to apply to the value.",
2198-
title="Validation Strategy",
2199-
)
2180+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2181+
...,
2182+
description="The validation strategy to apply to the value.",
2183+
title="Validation Strategy",
22002184
)
22012185

22022186

@@ -2221,12 +2205,12 @@ class ConfigAddFields(BaseModel):
22212205

22222206
class CompositeErrorHandler(BaseModel):
22232207
type: Literal["CompositeErrorHandler"]
2224-
error_handlers: List[
2225-
Union[CompositeErrorHandler, DefaultErrorHandler, CustomErrorHandler]
2226-
] = Field(
2227-
...,
2228-
description="List of error handlers to iterate on to determine how to handle a failed response.",
2229-
title="Error Handlers",
2208+
error_handlers: List[Union[CompositeErrorHandler, DefaultErrorHandler, CustomErrorHandler]] = (
2209+
Field(
2210+
...,
2211+
description="List of error handlers to iterate on to determine how to handle a failed response.",
2212+
title="Error Handlers",
2213+
)
22302214
)
22312215
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
22322216

@@ -2388,9 +2372,9 @@ class Config:
23882372

23892373
type: Literal["DeclarativeSource"]
23902374
check: Union[CheckStream, CheckDynamicStream]
2391-
streams: Optional[
2392-
List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]
2393-
] = None
2375+
streams: Optional[List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]] = (
2376+
None
2377+
)
23942378
dynamic_streams: List[DynamicDeclarativeStream]
23952379
version: str = Field(
23962380
...,
@@ -2515,20 +2499,16 @@ class Config:
25152499
extra = Extra.allow
25162500

25172501
type: Literal["DeclarativeStream"]
2518-
name: Optional[str] = Field(
2519-
"", description="The stream name.", example=["Users"], title="Name"
2520-
)
2502+
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
25212503
retriever: Union[SimpleRetriever, AsyncRetriever, CustomRetriever] = Field(
25222504
...,
25232505
description="Component used to coordinate how records are extracted across stream slices and request pages.",
25242506
title="Retriever",
25252507
)
2526-
incremental_sync: Optional[Union[DatetimeBasedCursor, IncrementingCountCursor]] = (
2527-
Field(
2528-
None,
2529-
description="Component used to fetch data incrementally based on a time field in the data.",
2530-
title="Incremental Sync",
2531-
)
2508+
incremental_sync: Optional[Union[DatetimeBasedCursor, IncrementingCountCursor]] = Field(
2509+
None,
2510+
description="Component used to fetch data incrementally based on a time field in the data.",
2511+
title="Incremental Sync",
25322512
)
25332513
primary_key: Optional[PrimaryKey] = Field("", title="Primary Key")
25342514
schema_loader: Optional[
@@ -2702,20 +2682,18 @@ class HttpRequester(BaseModelWithDeprecations):
27022682
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.",
27032683
title="Query Properties",
27042684
)
2705-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2706-
Field(
2707-
None,
2708-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2709-
examples=[
2710-
{"unit": "day"},
2711-
{
2712-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2713-
},
2714-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2715-
{"sort_by[asc]": "updated_at"},
2716-
],
2717-
title="Query Parameters",
2718-
)
2685+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2686+
None,
2687+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2688+
examples=[
2689+
{"unit": "day"},
2690+
{
2691+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2692+
},
2693+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2694+
{"sort_by[asc]": "updated_at"},
2695+
],
2696+
title="Query Parameters",
27192697
)
27202698
request_headers: Optional[Union[Dict[str, str], str]] = Field(
27212699
None,
@@ -2887,9 +2865,7 @@ class QueryProperties(BaseModel):
28872865

28882866
class StateDelegatingStream(BaseModel):
28892867
type: Literal["StateDelegatingStream"]
2890-
name: str = Field(
2891-
..., description="The stream name.", example=["Users"], title="Name"
2892-
)
2868+
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
28932869
full_refresh_stream: DeclarativeStream = Field(
28942870
...,
28952871
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2976,17 +2952,13 @@ class AsyncRetriever(BaseModel):
29762952
status_extractor: Union[DpathExtractor, CustomRecordExtractor] = Field(
29772953
..., description="Responsible for fetching the actual status of the async job."
29782954
)
2979-
download_target_extractor: Optional[
2980-
Union[DpathExtractor, CustomRecordExtractor]
2981-
] = Field(
2955+
download_target_extractor: Optional[Union[DpathExtractor, CustomRecordExtractor]] = Field(
29822956
None,
29832957
description="Responsible for fetching the final result `urls` provided by the completed / finished / ready async job.",
29842958
)
29852959
download_extractor: Optional[
29862960
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
2987-
] = Field(
2988-
None, description="Responsible for fetching the records from provided urls."
2989-
)
2961+
] = Field(None, description="Responsible for fetching the records from provided urls.")
29902962
creation_requester: Union[HttpRequester, CustomRequester] = Field(
29912963
...,
29922964
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)