Skip to content

Commit f42e98b

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint and format issues
1 parent 2ff96b0 commit f42e98b

File tree

2 files changed

+33
-62
lines changed

2 files changed

+33
-62
lines changed

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 32 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,7 @@ class OAuthAuthenticator(BaseModel):
604604
scopes: Optional[List[str]] = Field(
605605
None,
606606
description="List of scopes that should be granted to the access token.",
607-
examples=[
608-
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
609-
],
607+
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
610608
title="Scopes",
611609
)
612610
token_expiry_date: Optional[str] = Field(
@@ -1010,28 +1008,24 @@ class OAuthConfigSpecification(BaseModel):
10101008
class Config:
10111009
extra = Extra.allow
10121010

1013-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1014-
Field(
1015-
None,
1016-
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 }",
1017-
examples=[
1018-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1019-
{
1020-
"app_id": {
1021-
"type": "string",
1022-
"path_in_connector_config": ["info", "app_id"],
1023-
}
1024-
},
1025-
],
1026-
title="OAuth user input",
1027-
)
1011+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1012+
None,
1013+
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 }",
1014+
examples=[
1015+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1016+
{
1017+
"app_id": {
1018+
"type": "string",
1019+
"path_in_connector_config": ["info", "app_id"],
1020+
}
1021+
},
1022+
],
1023+
title="OAuth user input",
10281024
)
1029-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1030-
Field(
1031-
None,
1032-
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 }',
1033-
title="DeclarativeOAuth Connector Specification",
1034-
)
1025+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1026+
None,
1027+
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 }',
1028+
title="DeclarativeOAuth Connector Specification",
10351029
)
10361030
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
10371031
None,
@@ -1049,9 +1043,7 @@ class Config:
10491043
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
10501044
None,
10511045
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 }",
1052-
examples=[
1053-
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1054-
],
1046+
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
10551047
title="OAuth input specification",
10561048
)
10571049
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1637,9 +1629,7 @@ class RecordSelector(BaseModel):
16371629
description="Responsible for filtering records to be emitted by the Source.",
16381630
title="Record Filter",
16391631
)
1640-
schema_normalization: Optional[
1641-
Union[SchemaNormalization, CustomSchemaNormalization]
1642-
] = Field(
1632+
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
16431633
SchemaNormalization.None_,
16441634
description="Responsible for normalization according to the schema.",
16451635
title="Schema Normalization",
@@ -1813,16 +1803,12 @@ class Config:
18131803
description="Component used to coordinate how records are extracted across stream slices and request pages.",
18141804
title="Retriever",
18151805
)
1816-
incremental_sync: Optional[Union[CustomIncrementalSync, DatetimeBasedCursor]] = (
1817-
Field(
1818-
None,
1819-
description="Component used to fetch data incrementally based on a time field in the data.",
1820-
title="Incremental Sync",
1821-
)
1822-
)
1823-
name: Optional[str] = Field(
1824-
"", description="The stream name.", example=["Users"], title="Name"
1806+
incremental_sync: Optional[Union[CustomIncrementalSync, DatetimeBasedCursor]] = Field(
1807+
None,
1808+
description="Component used to fetch data incrementally based on a time field in the data.",
1809+
title="Incremental Sync",
18251810
)
1811+
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
18261812
primary_key: Optional[PrimaryKey] = Field(
18271813
"", description="The primary key of the stream.", title="Primary Key"
18281814
)
@@ -2132,11 +2118,7 @@ class SimpleRetriever(BaseModel):
21322118
CustomPartitionRouter,
21332119
ListPartitionRouter,
21342120
SubstreamPartitionRouter,
2135-
List[
2136-
Union[
2137-
CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter
2138-
]
2139-
],
2121+
List[Union[CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter]],
21402122
]
21412123
] = Field(
21422124
[],
@@ -2180,9 +2162,7 @@ class AsyncRetriever(BaseModel):
21802162
)
21812163
download_extractor: Optional[
21822164
Union[CustomRecordExtractor, DpathExtractor, ResponseToFileExtractor]
2183-
] = Field(
2184-
None, description="Responsible for fetching the records from provided urls."
2185-
)
2165+
] = Field(None, description="Responsible for fetching the records from provided urls.")
21862166
creation_requester: Union[CustomRequester, HttpRequester] = Field(
21872167
...,
21882168
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",
@@ -2216,11 +2196,7 @@ class AsyncRetriever(BaseModel):
22162196
CustomPartitionRouter,
22172197
ListPartitionRouter,
22182198
SubstreamPartitionRouter,
2219-
List[
2220-
Union[
2221-
CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter
2222-
]
2223-
],
2199+
List[Union[CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter]],
22242200
]
22252201
] = Field(
22262202
[],
@@ -2288,12 +2264,10 @@ class DynamicDeclarativeStream(BaseModel):
22882264
stream_template: DeclarativeStream = Field(
22892265
..., description="Reference to the stream template.", title="Stream Template"
22902266
)
2291-
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = (
2292-
Field(
2293-
...,
2294-
description="Component resolve and populates stream templates with components values.",
2295-
title="Components Resolver",
2296-
)
2267+
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = Field(
2268+
...,
2269+
description="Component resolve and populates stream templates with components values.",
2270+
title="Components Resolver",
22972271
)
22982272

22992273

unit_tests/sources/declarative/schema/test_dynamic_schema_loader.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@
8585
"key_pointer": ["name"],
8686
"type_pointer": ["type"],
8787
"types_mapping": [
88-
{
89-
"target_type": "string",
90-
"current_type": "singleLineText"
91-
},
88+
{"target_type": "string", "current_type": "singleLineText"},
9289
{
9390
"target_type": "array",
9491
"current_type": "formula",

0 commit comments

Comments
 (0)