-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/sdk_paginators_and_oauth_methods #36
Merged
jlloyd-widen
merged 22 commits into
Widen:main
from
s7clarke10:feature/sdk_supported_oauth_headers
Jul 26, 2023
Merged
Feature/sdk_paginators_and_oauth_methods #36
jlloyd-widen
merged 22 commits into
Widen:main
from
s7clarke10:feature/sdk_supported_oauth_headers
Jul 26, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature/add paginators and authenticators
This was referenced Jul 24, 2023
jlloyd-widen
approved these changes
Jul 26, 2023
This was referenced Aug 4, 2023
This was referenced Aug 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces new Authenticators and Paginators to
tap-rest-api-msdk
. (it is a refactored approach to previous PR's). With this feature there is greater support for a range of API's - making this tap the swiss army knife for accessing API's.Summary
get_next_page_token
to supportget_new_paginator
. This removes the warnings in the logs.auth
andpagination
keeping a clean design.auth
method aws, to support ingestion from AWS REST End-point e.g. OpenSearch.Paginators
Each REST API is different. This PR builds on the concept of picking an appropriate request and response style for the API. Select an appropriate
pagination_request_style
to pick the paginator you require. In most cases this needs to be coupled with an appropriatepaginator_response_style
to process the response and pick the next page location in the body or headers.Supported Paginators as part of this PR include:
jsonpath_paginator
ordefault
- This style obtains the token for the next page from a specific location in the response body via JSONPath notation. In many situations thejsonpath_paginator
is a more appropriate paginator to thehateoas_paginator
.next_page_token_path
- The jsonpath to next page token. Example:"$['@odata.nextLink']"
, this locates the token returned via the Microsoft Graph API. Default'$.next_page'
for thejsonpath_paginator
paginator only otherwise None.offset_paginator
orstyle1
- This style uses URL parameters named offset and limitoffset
is calculated from the previous response, or not set if there is no previous responsepagination_page_size
- Sets a limit to number of records per page / response. Default25
records.pagination_limit_per_page_param
- the name of the API parameter to limit number of records per page. Default parameter namelimit
.pagination_total_limit_param
- The name of the param that indicates the total limit e.g. total, count. Defaults to totalnext_page_token_path
- Used to locate an appropriate link in the response. Default None - but looks in thepagination
section of the JSON response by default. Example, jsonpath to get the offset from the NOAA API'$.metadata.resultset'
.simple_header_paginator
- This style uses links in the Header Response to locate the next page. Example thex-next-page
link used by the Gitlab API.header_link_paginator
- This style uses the default header link paginator from the Meltano SDK.restapi_header_link_paginator
- This style is a variant on the header_link_paginator. It supports the ability to read from GitHub API.pagination_page_size
- Sets a limit to number of records per page / response. Default25
records.pagination_limit_per_page_param
- the name of the API parameter to limit number of records per page. Default parameter nameper_page
.pagination_results_limit
- Restricts the total number of records returned from the API. Default None i.e. no limit.hateoas_paginator
- This style parses the next_token response for the parameters to pass. It is used by API's utilising the HATEOAS Rest style HATEOAS, including FHIR API's.pagination_page_size
- Sets a limit to number of records per page / response. Default None.pagination_limit_per_page_param
- the name of the API parameter to limit number of records per page e.g._count
for FHIR API's. Default None.single_page_paginator
- A paginator that does works with single-page endpoints.page_number_paginator
- Paginator class for APIs that use page number. Looks at the response link to determine more pages.next_page_token_path
- Use to locate an appropriate link in the response. Default"hasMore"
.Authentication
This PR introduces many additional forms of authentication that weren't possible with just headers in the request (for example OAuth).
The Meltano SDK introduced a number of authentication methods, which have been supported with this feature. The feature utilizes the available SDK Authenticators https://github.com/meltano/sdk/blob/main/singer_sdk/authenticators.py.
While new auth methods are supported, by default for legacy support, you can still pass Authentication via headers, there is no breaking changes as a result. New supported authenticators :
aws_credentials
parameter.Please note that support for OAuthJWTAuthentication has not been developed.
Other Changes:
Note: I am aware that there are no supported API tests as they are time consuming to build and test. I have however with my limited time tested against of variety of API's available to me. Perhaps
faker
python package to help simulate tests for a variety of API's and responses. This appears to be used by tap-dbt https://github.com/MeltanoLabs/tap-dbt/blob/main/tests/test_core.py