From 915f74237432059ef2f2791caa79eb9722e3c73c Mon Sep 17 00:00:00 2001 From: Sherif Nada Date: Tue, 31 Aug 2021 17:11:51 -0700 Subject: [PATCH 1/2] add oauth params to protocol --- .../airbyte_protocol/airbyte_protocol.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/airbyte-protocol/models/src/main/resources/airbyte_protocol/airbyte_protocol.yaml b/airbyte-protocol/models/src/main/resources/airbyte_protocol/airbyte_protocol.yaml index 080158c91f4da..51c76376bcd66 100644 --- a/airbyte-protocol/models/src/main/resources/airbyte_protocol/airbyte_protocol.yaml +++ b/airbyte-protocol/models/src/main/resources/airbyte_protocol/airbyte_protocol.yaml @@ -208,6 +208,25 @@ definitions: - overwrite #- upsert_dedup # TODO chris: SCD Type 1 can be implemented later - append_dedup # SCD Type 1 & 2 + OAuth2Specification: + description: An object containing any metadata needed to describe this connector's Oauth flow + type: object + properties: + oauthFlowInitParameters: + description: "Pointers to the fields in the ConnectorSpecification which are needed to obtain the initial refresh/access tokens for the OAuth flow. + Each inner array represents the path in the ConnectorSpecification of the referenced field. + + For example. + + Assume the ConnectorSpecification contains params 'app_secret', 'app_id' which are needed to get the initial refresh token. + If they are not nested in the config, then the array would look like this [['app_secret'], ['app_id']] + If they are nested inside, say, an object called 'auth_params' then this array would be [['auth_params', 'app_secret'], ['auth_params', 'app_id']]" + type: array + items: + description: A list of strings which describe the path inside a JSON object for finding the + type: array + items: + type: string ConnectorSpecification: description: Specification of a connector (source/destination) type: object @@ -250,3 +269,12 @@ definitions: type: array items: "$ref": "#/definitions/DestinationSyncMode" + authSpecification: + type: object + properties: + auth_type: + type: string + enum: ["oauth2.0"] # Future auth types should be added here + oauth2Specification: + description: If the connector supports OAuth, this field should be non-null. + "$ref": "#/definitions/OAuth2Specification" From e31a6117b5d327c5cb529789f4869a33b8df8d31 Mon Sep 17 00:00:00 2001 From: "Sherif A. Nada" Date: Wed, 1 Sep 2021 11:09:41 -0700 Subject: [PATCH 2/2] Update generated AirbyteProtocol models to contain [Oauth changes] (#5777) --- airbyte-cdk/python/CHANGELOG.md | 3 +++ .../airbyte_cdk/models/airbyte_protocol.py | 20 +++++++++++++++++++ airbyte-cdk/python/setup.py | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/airbyte-cdk/python/CHANGELOG.md b/airbyte-cdk/python/CHANGELOG.md index b4bb9ef19b361..44cbfcc739d3b 100644 --- a/airbyte-cdk/python/CHANGELOG.md +++ b/airbyte-cdk/python/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.1.16 +Update generated AirbyteProtocol models to contain [Oauth changes](https://github.com/airbytehq/airbyte/pull/5776). + ## 0.1.15 Add \_limit and \_page_size as internal config parameters for SAT diff --git a/airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py b/airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py index da45f5cebd143..f76be5651fbcc 100644 --- a/airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py +++ b/airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py @@ -103,6 +103,25 @@ class DestinationSyncMode(Enum): append_dedup = "append_dedup" +class OAuth2Specification(BaseModel): + oauthFlowInitParameters: Optional[List[List[str]]] = Field( + None, + description="Pointers to the fields in the ConnectorSpecification which are needed to obtain the initial refresh/access tokens for the OAuth flow. Each inner array represents the path in the ConnectorSpecification of the referenced field.\nFor example.\nAssume the ConnectorSpecification contains params 'app_secret', 'app_id' which are needed to get the initial refresh token. If they are not nested in the config, then the array would look like this [['app_secret'], ['app_id']] If they are nested inside, say, an object called 'auth_params' then this array would be [['auth_params', 'app_secret'], ['auth_params', 'app_id']]", + ) + + +class AuthType(Enum): + oauth2_0 = "oauth2.0" + + +class AuthSpecification(BaseModel): + auth_type: Optional[AuthType] = None + oauth2Specification: Optional[OAuth2Specification] = Field( + None, + description="If the connector supports OAuth, this field should be non-null.", + ) + + class ConnectorSpecification(BaseModel): class Config: extra = Extra.allow @@ -119,6 +138,7 @@ class Config: supported_destination_sync_modes: Optional[List[DestinationSyncMode]] = Field( None, description="List of destination sync modes supported by the connector" ) + authSpecification: Optional[AuthSpecification] = None class AirbyteStream(BaseModel): diff --git a/airbyte-cdk/python/setup.py b/airbyte-cdk/python/setup.py index f4369c6cb5161..91a52544282c1 100644 --- a/airbyte-cdk/python/setup.py +++ b/airbyte-cdk/python/setup.py @@ -35,7 +35,7 @@ setup( name="airbyte-cdk", - version="0.1.15", + version="0.1.16", description="A framework for writing Airbyte Connectors.", long_description=README, long_description_content_type="text/markdown",