-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add the /manifest_template endpoint to return a string representation of the manifest template #19367
Merged
Merged
Add the /manifest_template endpoint to return a string representation of the manifest template #19367
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,56 @@ | |
|
||
class DefaultApiImpl(DefaultApi): | ||
async def get_manifest_template(self) -> str: | ||
return "Hello World" | ||
return """version: "0.1.0" | ||
|
||
definitions: | ||
selector: | ||
extractor: | ||
field_pointer: [] | ||
requester: | ||
url_base: "https://example.com" | ||
http_method: "GET" | ||
authenticator: | ||
type: BearerAuthenticator | ||
api_token: "{{ config['api_key'] }}" | ||
retriever: | ||
record_selector: | ||
$ref: "*ref(definitions.selector)" | ||
paginator: | ||
type: NoPagination | ||
requester: | ||
$ref: "*ref(definitions.requester)" | ||
base_stream: | ||
retriever: | ||
$ref: "*ref(definitions.retriever)" | ||
customers_stream: | ||
$ref: "*ref(definitions.base_stream)" | ||
$options: | ||
name: "customers" | ||
primary_key: "id" | ||
path: "/example" | ||
|
||
streams: | ||
- "*ref(definitions.customers_stream)" | ||
|
||
check: | ||
stream_names: | ||
- "customers" | ||
|
||
spec: | ||
documentation_url: https://docsurl.com | ||
connection_specification: | ||
title: Source Name Spec # 'TODO: Replace this with the name of your source.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this used to be |
||
type: object | ||
required: | ||
- api_key | ||
additionalProperties: true | ||
properties: | ||
# 'TODO: This schema defines the configuration required for the source. This usually involves metadata such as database and/or authentication information.': | ||
api_key: | ||
type: string | ||
description: API Key | ||
""" | ||
|
||
async def list_streams(self, streams_list_request_body: StreamsListRequestBody = Body(None, description="")) -> StreamsListRead: | ||
raise Exception("not yet implemented") | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned. In the generator this is defined as
/{{ config['api_key'] }}
because we need to escape the template so that the template generator doesn't fill this with anything. We want the{{ }}
to actually be present in the file. But for the server version, we don't need to escape anythingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way that you could reduce the duplication here would be to have a shared python method which takes in arguments for the api_token value and the spec title value, and returns this string with those arguments inserted. Then this method could call it and pass in the api_token without the slash, and the generator could call it and pass in the api_token with the slash, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm yeah that sounds like it could work, but I might table that type of change for the future, I don't think its necessarily critical to keep things perfectly in sync in V0. And we could have some thorny edges trying to read the YAML template from
airbyte-integrations/connector-templates/source-configuration-based/source_{{snakeCase name}}/{{snakeCase name}}.yaml.hbs
across python packages 😅