Skip to content

Commit 245e214

Browse files
author
maxime.c
committed
fix test
1 parent b553004 commit 245e214

File tree

3 files changed

+91
-66
lines changed

3 files changed

+91
-66
lines changed

airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,14 +1433,12 @@ definitions:
14331433
type: array
14341434
items:
14351435
type: integer
1436-
default: [400]
14371436
examples:
14381437
- [400, 500]
14391438
refresh_token_error_key:
14401439
title: Refresh Token Error Key
14411440
description: Key to Identify refresh token error in response (Refresh Token Error Status Codes and Refresh Token Error Values should be also specified).
14421441
type: string
1443-
default: "error"
14441442
examples:
14451443
- "error"
14461444
refresh_token_error_values:
@@ -1449,7 +1447,6 @@ definitions:
14491447
type: array
14501448
items:
14511449
type: string
1452-
default: ["invalid_grant", "invalid_permissions"]
14531450
examples:
14541451
- ["invalid_grant", "invalid_permissions"]
14551452
refresh_token_updater:

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

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

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",
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+
)
942944
)
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",
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+
)
947951
)
948952
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
949953
None,
@@ -961,7 +965,9 @@ class Config:
961965
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
962966
None,
963967
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 }",
964-
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
968+
examples=[
969+
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
970+
],
965971
title="OAuth input specification",
966972
)
967973
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1465,7 +1471,9 @@ class CustomConfigTransformation(BaseModel):
14651471
class_name: str = Field(
14661472
...,
14671473
description="Fully-qualified name of the class that will be implementing the custom config transformation. The format is `source_<name>.<package>.<class_name>`.",
1468-
examples=["source_declarative_manifest.components.MyCustomConfigTransformation"],
1474+
examples=[
1475+
"source_declarative_manifest.components.MyCustomConfigTransformation"
1476+
],
14691477
)
14701478
parameters: Optional[Dict[str, Any]] = Field(
14711479
None,
@@ -1883,7 +1891,9 @@ class OAuthAuthenticator(BaseModel):
18831891
scopes: Optional[List[str]] = Field(
18841892
None,
18851893
description="List of scopes that should be granted to the access token.",
1886-
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
1894+
examples=[
1895+
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
1896+
],
18871897
title="Scopes",
18881898
)
18891899
token_expiry_date: Optional[str] = Field(
@@ -1899,19 +1909,19 @@ class OAuthAuthenticator(BaseModel):
18991909
title="Token Expiry Date Format",
19001910
)
19011911
refresh_token_error_status_codes: Optional[List[int]] = Field(
1902-
[400],
1912+
None,
19031913
description="Status Codes to Identify refresh token error in response (Refresh Token Error Key and Refresh Token Error Values should be also specified). Responses with one of the error status code and containing an error value will be flagged as a config error",
19041914
examples=[[400, 500]],
19051915
title="Refresh Token Error Status Codes",
19061916
)
19071917
refresh_token_error_key: Optional[str] = Field(
1908-
"error",
1918+
None,
19091919
description="Key to Identify refresh token error in response (Refresh Token Error Status Codes and Refresh Token Error Values should be also specified).",
19101920
examples=["error"],
19111921
title="Refresh Token Error Key",
19121922
)
19131923
refresh_token_error_values: Optional[List[str]] = Field(
1914-
["invalid_grant", "invalid_permissions"],
1924+
None,
19151925
description='List of values to check for exception during token refresh process. Used to check if the error found in the response matches the key from the Refresh Token Error Key field (e.g. response={"error": "invalid_grant"}). Only responses with one of the error status code and containing an error value will be flagged as a config error',
19161926
examples=[["invalid_grant", "invalid_permissions"]],
19171927
title="Refresh Token Error Values",
@@ -2100,7 +2110,9 @@ class RecordSelector(BaseModel):
21002110
description="Responsible for filtering records to be emitted by the Source.",
21012111
title="Record Filter",
21022112
)
2103-
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
2113+
schema_normalization: Optional[
2114+
Union[SchemaNormalization, CustomSchemaNormalization]
2115+
] = Field(
21042116
None,
21052117
description="Responsible for normalization according to the schema.",
21062118
title="Schema Normalization",
@@ -2142,10 +2154,12 @@ class DpathValidator(BaseModel):
21422154
],
21432155
title="Field Path",
21442156
)
2145-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2146-
...,
2147-
description="The condition that the specified config value will be evaluated against",
2148-
title="Validation Strategy",
2157+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2158+
Field(
2159+
...,
2160+
description="The condition that the specified config value will be evaluated against",
2161+
title="Validation Strategy",
2162+
)
21492163
)
21502164

21512165

@@ -2162,10 +2176,12 @@ class PredicateValidator(BaseModel):
21622176
],
21632177
title="Value",
21642178
)
2165-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2166-
...,
2167-
description="The validation strategy to apply to the value.",
2168-
title="Validation Strategy",
2179+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2180+
Field(
2181+
...,
2182+
description="The validation strategy to apply to the value.",
2183+
title="Validation Strategy",
2184+
)
21692185
)
21702186

21712187

@@ -2190,12 +2206,12 @@ class ConfigAddFields(BaseModel):
21902206

21912207
class CompositeErrorHandler(BaseModel):
21922208
type: Literal["CompositeErrorHandler"]
2193-
error_handlers: List[Union[CompositeErrorHandler, DefaultErrorHandler, CustomErrorHandler]] = (
2194-
Field(
2195-
...,
2196-
description="List of error handlers to iterate on to determine how to handle a failed response.",
2197-
title="Error Handlers",
2198-
)
2209+
error_handlers: List[
2210+
Union[CompositeErrorHandler, DefaultErrorHandler, CustomErrorHandler]
2211+
] = Field(
2212+
...,
2213+
description="List of error handlers to iterate on to determine how to handle a failed response.",
2214+
title="Error Handlers",
21992215
)
22002216
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
22012217

@@ -2357,9 +2373,9 @@ class Config:
23572373

23582374
type: Literal["DeclarativeSource"]
23592375
check: Union[CheckStream, CheckDynamicStream]
2360-
streams: Optional[List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]] = (
2361-
None
2362-
)
2376+
streams: Optional[
2377+
List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]
2378+
] = None
23632379
dynamic_streams: List[DynamicDeclarativeStream]
23642380
version: str = Field(
23652381
...,
@@ -2484,16 +2500,20 @@ class Config:
24842500
extra = Extra.allow
24852501

24862502
type: Literal["DeclarativeStream"]
2487-
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
2503+
name: Optional[str] = Field(
2504+
"", description="The stream name.", example=["Users"], title="Name"
2505+
)
24882506
retriever: Union[SimpleRetriever, AsyncRetriever, CustomRetriever] = Field(
24892507
...,
24902508
description="Component used to coordinate how records are extracted across stream slices and request pages.",
24912509
title="Retriever",
24922510
)
2493-
incremental_sync: Optional[Union[DatetimeBasedCursor, IncrementingCountCursor]] = Field(
2494-
None,
2495-
description="Component used to fetch data incrementally based on a time field in the data.",
2496-
title="Incremental Sync",
2511+
incremental_sync: Optional[Union[DatetimeBasedCursor, IncrementingCountCursor]] = (
2512+
Field(
2513+
None,
2514+
description="Component used to fetch data incrementally based on a time field in the data.",
2515+
title="Incremental Sync",
2516+
)
24972517
)
24982518
primary_key: Optional[PrimaryKey] = Field("", title="Primary Key")
24992519
schema_loader: Optional[
@@ -2667,18 +2687,20 @@ class HttpRequester(BaseModelWithDeprecations):
26672687
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.",
26682688
title="Query Properties",
26692689
)
2670-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2671-
None,
2672-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2673-
examples=[
2674-
{"unit": "day"},
2675-
{
2676-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2677-
},
2678-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2679-
{"sort_by[asc]": "updated_at"},
2680-
],
2681-
title="Query Parameters",
2690+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2691+
Field(
2692+
None,
2693+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2694+
examples=[
2695+
{"unit": "day"},
2696+
{
2697+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2698+
},
2699+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2700+
{"sort_by[asc]": "updated_at"},
2701+
],
2702+
title="Query Parameters",
2703+
)
26822704
)
26832705
request_headers: Optional[Union[Dict[str, str], str]] = Field(
26842706
None,
@@ -2850,7 +2872,9 @@ class QueryProperties(BaseModel):
28502872

28512873
class StateDelegatingStream(BaseModel):
28522874
type: Literal["StateDelegatingStream"]
2853-
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
2875+
name: str = Field(
2876+
..., description="The stream name.", example=["Users"], title="Name"
2877+
)
28542878
full_refresh_stream: DeclarativeStream = Field(
28552879
...,
28562880
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2937,13 +2961,17 @@ class AsyncRetriever(BaseModel):
29372961
status_extractor: Union[DpathExtractor, CustomRecordExtractor] = Field(
29382962
..., description="Responsible for fetching the actual status of the async job."
29392963
)
2940-
download_target_extractor: Optional[Union[DpathExtractor, CustomRecordExtractor]] = Field(
2964+
download_target_extractor: Optional[
2965+
Union[DpathExtractor, CustomRecordExtractor]
2966+
] = Field(
29412967
None,
29422968
description="Responsible for fetching the final result `urls` provided by the completed / finished / ready async job.",
29432969
)
29442970
download_extractor: Optional[
29452971
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
2946-
] = Field(None, description="Responsible for fetching the records from provided urls.")
2972+
] = Field(
2973+
None, description="Responsible for fetching the records from provided urls."
2974+
)
29472975
creation_requester: Union[HttpRequester, CustomRequester] = Field(
29482976
...,
29492977
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)