Skip to content

Commit

Permalink
[protocol] add oauth params to connector specification (#5776)
Browse files Browse the repository at this point in the history
  • Loading branch information
sherifnada authored Sep 1, 2021
1 parent 7361263 commit 75a6a75
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
3 changes: 3 additions & 0 deletions airbyte-cdk/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
20 changes: 20 additions & 0 deletions airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion airbyte-cdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

0 comments on commit 75a6a75

Please sign in to comment.