Skip to content

Commit 79f3f1a

Browse files
committed
Update models
1 parent 4ee3fb5 commit 79f3f1a

File tree

2 files changed

+70
-103
lines changed

2 files changed

+70
-103
lines changed

airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,34 +1741,9 @@ definitions:
17411741
$parameters:
17421742
type: object
17431743
additionalProperties: true
1744-
KeyValueExtractor:
1745-
title: Key Value Extractor
1746-
description: Record extractor that extract with .
1747-
type: object
1748-
required:
1749-
- type
1750-
- keys_extractor
1751-
- values_extractor
1752-
properties:
1753-
type:
1754-
type: string
1755-
enum: [ KeyValueExtractor ]
1756-
keys_extractor:
1757-
description: placeholder
1758-
anyOf:
1759-
- "$ref": "#/definitions/DpathExtractor"
1760-
- "$ref": "#/definitions/CustomRecordExtractor"
1761-
values_extractor:
1762-
description: placeholder
1763-
anyOf:
1764-
- "$ref": "#/definitions/DpathExtractor"
1765-
- "$ref": "#/definitions/CustomRecordExtractor"
1766-
$parameters:
1767-
type: object
1768-
additionalProperties: true
17691744
CombinedExtractor:
17701745
title: Combined Extractor
1771-
description: Record extractor that extract with .
1746+
description: Record extractor that merges the output of multiple sub-extractors into a single record.
17721747
type: object
17731748
required:
17741749
- type
@@ -2366,12 +2341,6 @@ definitions:
23662341
- "$ref": "#/definitions/AsyncRetriever"
23672342
- "$ref": "#/definitions/CustomRetriever"
23682343
- "$ref": "#/definitions/SimpleRetriever"
2369-
schema_filter:
2370-
title: Schema Filter
2371-
description: placeholder
2372-
anyOf:
2373-
- "$ref": "#/definitions/RecordFilter"
2374-
- "$ref": "#/definitions/CustomRecordFilter"
23752344
schema_transformations:
23762345
title: Schema Transformations
23772346
description: A list of transformations to be applied to the schema.
@@ -3370,7 +3339,6 @@ definitions:
33703339
anyOf:
33713340
- "$ref": "#/definitions/DpathExtractor"
33723341
- "$ref": "#/definitions/CombinedExtractor"
3373-
- "$ref": "#/definitions/KeyValueExtractor"
33743342
- "$ref": "#/definitions/CustomRecordExtractor"
33753343
record_filter:
33763344
title: Record Filter
@@ -4050,9 +4018,6 @@ definitions:
40504018
title: Value Type
40514019
description: The expected data type of the value. If omitted, the type will be inferred from the value provided.
40524020
"$ref": "#/definitions/ValueType"
4053-
create_or_update:
4054-
type: boolean
4055-
default: false
40564021
$parameters:
40574022
type: object
40584023
additionalProperties: true
@@ -4104,10 +4069,6 @@ definitions:
41044069
- ["data"]
41054070
- ["data", "streams"]
41064071
- ["data", "{{ parameters.name }}"]
4107-
default_values:
4108-
title: Default Values
4109-
description: placeholder
4110-
type: array
41114072
$parameters:
41124073
type: object
41134074
additionalProperties: true
@@ -4119,11 +4080,7 @@ definitions:
41194080
type: string
41204081
enum: [ConfigComponentsResolver]
41214082
stream_config:
4122-
anyOf:
4123-
- type: array
4124-
items:
4125-
"$ref": "#/definitions/StreamConfig"
4126-
- "$ref": "#/definitions/StreamConfig"
4083+
"$ref": "#/definitions/StreamConfig"
41274084
components_mapping:
41284085
type: array
41294086
items:

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 68 additions & 58 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(
@@ -1478,7 +1486,6 @@ class ComponentMappingDefinition(BaseModel):
14781486
description="The expected data type of the value. If omitted, the type will be inferred from the value provided.",
14791487
title="Value Type",
14801488
)
1481-
create_or_update: Optional[bool] = False
14821489
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
14831490

14841491

@@ -1490,13 +1497,12 @@ class StreamConfig(BaseModel):
14901497
examples=[["data"], ["data", "streams"], ["data", "{{ parameters.name }}"]],
14911498
title="Configs Pointer",
14921499
)
1493-
default_values: Optional[List] = Field(None, description="placeholder", title="Default Values")
14941500
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
14951501

14961502

14971503
class ConfigComponentsResolver(BaseModel):
14981504
type: Literal["ConfigComponentsResolver"]
1499-
stream_config: Union[List[StreamConfig], StreamConfig]
1505+
stream_config: StreamConfig
15001506
components_mapping: List[ComponentMappingDefinition]
15011507
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
15021508

@@ -1523,6 +1529,10 @@ class Config:
15231529
query: Dict[str, Any] = Field(..., description="The GraphQL query to be executed")
15241530

15251531

1532+
class KeyValueExtractor(BaseModel):
1533+
__root__: Any
1534+
1535+
15261536
class AddedFieldDefinition(BaseModel):
15271537
type: Literal["AddedFieldDefinition"]
15281538
path: List[str] = Field(
@@ -1844,21 +1854,12 @@ class DefaultPaginator(BaseModel):
18441854
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
18451855

18461856

1847-
class KeyValueExtractor(BaseModel):
1848-
type: Literal["KeyValueExtractor"]
1849-
keys_extractor: Union[DpathExtractor, CustomRecordExtractor] = Field(
1850-
..., description="placeholder"
1851-
)
1852-
values_extractor: Union[DpathExtractor, CustomRecordExtractor] = Field(
1853-
..., description="placeholder"
1854-
)
1855-
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
1856-
1857-
18581857
class CombinedExtractor(BaseModel):
18591858
type: Literal["CombinedExtractor"]
18601859
extractors: List[
1861-
Union[DpathExtractor, CombinedExtractor, KeyValueExtractor, CustomRecordExtractor]
1860+
Union[
1861+
DpathExtractor, CombinedExtractor, KeyValueExtractor, CustomRecordExtractor
1862+
]
18621863
] = Field(..., description="placeholder")
18631864
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
18641865

@@ -1900,13 +1901,15 @@ class ListPartitionRouter(BaseModel):
19001901

19011902
class RecordSelector(BaseModel):
19021903
type: Literal["RecordSelector"]
1903-
extractor: Union[DpathExtractor, CombinedExtractor, KeyValueExtractor, CustomRecordExtractor]
1904+
extractor: Union[DpathExtractor, CombinedExtractor, CustomRecordExtractor]
19041905
record_filter: Optional[Union[RecordFilter, CustomRecordFilter]] = Field(
19051906
None,
19061907
description="Responsible for filtering records to be emitted by the Source.",
19071908
title="Record Filter",
19081909
)
1909-
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
1910+
schema_normalization: Optional[
1911+
Union[SchemaNormalization, CustomSchemaNormalization]
1912+
] = Field(
19101913
None,
19111914
description="Responsible for normalization according to the schema.",
19121915
title="Schema Normalization",
@@ -2152,7 +2155,9 @@ class Config:
21522155
extra = Extra.allow
21532156

21542157
type: Literal["DeclarativeStream"]
2155-
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
2158+
name: Optional[str] = Field(
2159+
"", description="The stream name.", example=["Users"], title="Name"
2160+
)
21562161
retriever: Union[SimpleRetriever, AsyncRetriever, CustomRetriever] = Field(
21572162
...,
21582163
description="Component used to coordinate how records are extracted across stream slices and request pages.",
@@ -2330,18 +2335,20 @@ class HttpRequester(BaseModelWithDeprecations):
23302335
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.",
23312336
title="Fetch Properties from Endpoint",
23322337
)
2333-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2334-
None,
2335-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2336-
examples=[
2337-
{"unit": "day"},
2338-
{
2339-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2340-
},
2341-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2342-
{"sort_by[asc]": "updated_at"},
2343-
],
2344-
title="Query Parameters",
2338+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2339+
Field(
2340+
None,
2341+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2342+
examples=[
2343+
{"unit": "day"},
2344+
{
2345+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2346+
},
2347+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2348+
{"sort_by[asc]": "updated_at"},
2349+
],
2350+
title="Query Parameters",
2351+
)
23452352
)
23462353
request_headers: Optional[Union[Dict[str, str], str]] = Field(
23472354
None,
@@ -2433,9 +2440,6 @@ class DynamicSchemaLoader(BaseModel):
24332440
description="Component used to coordinate how records are extracted across stream slices and request pages.",
24342441
title="Retriever",
24352442
)
2436-
schema_filter: Optional[Union[RecordFilter, CustomRecordFilter]] = Field(
2437-
None, description="placeholder", title="Schema Filter"
2438-
)
24392443
schema_transformations: Optional[
24402444
List[
24412445
Union[
@@ -2534,7 +2538,9 @@ class QueryProperties(BaseModel):
25342538

25352539
class StateDelegatingStream(BaseModel):
25362540
type: Literal["StateDelegatingStream"]
2537-
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
2541+
name: str = Field(
2542+
..., description="The stream name.", example=["Users"], title="Name"
2543+
)
25382544
full_refresh_stream: DeclarativeStream = Field(
25392545
...,
25402546
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2623,7 +2629,9 @@ class AsyncRetriever(BaseModel):
26232629
)
26242630
download_extractor: Optional[
26252631
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
2626-
] = Field(None, description="Responsible for fetching the records from provided urls.")
2632+
] = Field(
2633+
None, description="Responsible for fetching the records from provided urls."
2634+
)
26272635
creation_requester: Union[HttpRequester, CustomRequester] = Field(
26282636
...,
26292637
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",
@@ -2763,10 +2771,12 @@ class DynamicDeclarativeStream(BaseModel):
27632771
stream_template: DeclarativeStream = Field(
27642772
..., description="Reference to the stream template.", title="Stream Template"
27652773
)
2766-
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = Field(
2767-
...,
2768-
description="Component resolve and populates stream templates with components values.",
2769-
title="Components Resolver",
2774+
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = (
2775+
Field(
2776+
...,
2777+
description="Component resolve and populates stream templates with components values.",
2778+
title="Components Resolver",
2779+
)
27702780
)
27712781

27722782

0 commit comments

Comments
 (0)