-
Notifications
You must be signed in to change notification settings - Fork 10
[tap-frontapp] - fix libraries and dependabot issues #27
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
base: master
Are you sure you want to change the base?
Conversation
setup.py
Outdated
@@ -25,4 +25,4 @@ | |||
"schemas": ["tap_frontapp/schemas/*.json"] | |||
}, | |||
include_package_data=True | |||
) | |||
) |
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.
Add new line at end of the file.
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.
I see new line is still missing.
tap_frontapp/__init__.py
Outdated
# Stream-level metadata select the stream | ||
metadata.append({ | ||
"metadata": { | ||
"selected": True # Make sure to select every stream |
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.
@gl-romil selected
is a non-discoverable metadata which can't written or read by the tap. Please refer getting-started documentation. Also I find some required discoverable metadata is missing from the catalog, refer docs for more details.
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.
Replaced 'selected' with discoverable metadata fields.
Added missing 'inclusion', inclusion-reason' , and 'selected-by-default'.
tap_frontapp/__init__.py
Outdated
# Creating a dict to change before converting | ||
catalog_dict = catalog.to_dict() | ||
|
||
required_streams = [ |
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.
You can use streams.METRIC_API_DESCRIPTION_KEY
instead of introducing new variable which already defines these stream names to required.
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.
Replaced static stream list with streams.METRIC_API_DESCRIPTION_KEY.keys()
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.
Requested changes in discover()
which may need changes in the other tap implementation as well as in the tests. Please take of those as well.
976e331
to
9f6165a
Compare
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.
All review comments are addressed.
tap_frontapp/__init__.py
Outdated
# Stream-level metadata select the stream | ||
metadata.append({ | ||
"metadata": { | ||
"selected": True # Make sure to select every stream |
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.
Replaced 'selected' with discoverable metadata fields.
Added missing 'inclusion', inclusion-reason' , and 'selected-by-default'.
tap_frontapp/__init__.py
Outdated
# Creating a dict to change before converting | ||
catalog_dict = catalog.to_dict() | ||
|
||
required_streams = [ |
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.
Replaced static stream list with streams.METRIC_API_DESCRIPTION_KEY.keys()
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.
Kindly review
2b2a85e
to
9f6165a
Compare
* [SAC-27536] Refactored discovery and sync- logic * [SAC-27535] Final clean up: discovery fixes,init and sync * Update discover.py Removed type annotations from the file as per review * Update schemas.py Removed type annotations from file as per review * Update sync.py Removed type annotations as per review * Update sync.py * Update __init__.py Removed type annotations as per comment * Update __init__.py * Update __init__.py Removed unnecessary header as per review * Update __init__.py * Update __init__.py Removed header comment * Update sync.py Removed file level docstring * Update test_client.py Add EOF --------- Co-authored-by: gl-romil <[email protected]>
tap_frontapp/discover.py
Outdated
def discover(): | ||
"""Run the discovery mode, prepare the catalog file and return the catalog.""" | ||
schemas, field_metadata = get_schemas() | ||
print("Schemas loaded:", schemas.keys()) |
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.
Please replace print()
but LOGGER.info()
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.
Also we need to do credential validation as we discussed for tap-braintree
.
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.
This is Done, Kindly check
Added LOGGER.info
Credentials Validation
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.
Created validate_credential function in init.py file
Replaces print with LOGGER
tap_frontapp/__init__.py
Outdated
def validate_credentials(token): | ||
"""Validates the FrontApp token using a simple API call""" | ||
headers = {"Authorization": f"Bearer {token}"} | ||
try: | ||
response = requests.get("https://api2.frontapp.com/me", headers=headers, timeout=10) | ||
if response.status_code == 200: | ||
LOGGER.info("Frontapp credentials validated successfully.") | ||
else: | ||
LOGGER.critical("Invalid Frontapp credentials. Status code: %s", response.status_code) | ||
sys.exit(1) | ||
except requests.exceptions.RequestException as err: | ||
LOGGER.critical("Credential validation failed: %s", str(err)) | ||
sys.exit(1) |
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.
Move this to discovery.py
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.
This is Done, Kindly review
Moved validate_credentials
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.
Kindly review
tests/unittests/test_client.py
Outdated
|
||
if __name__ == "__main__": | ||
unittest.main() |
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.
Please remove this but not holding PR for this.
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.
I have removed it.
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.
Removed
if name == "main":
- unittest.main()
Description of change
Updated FrontApp tap with Schema fixes and unit tests.
Fixed and streamlined 'init.py by ensuring all streams and their fields have proper metadata with 'selected: true' at both stream and field levels (breadcrum[]).
Added .circleci/config.yml to trigger CircleCI pipeline
Manual QA steps
Ran Discovery
Ran full sync
Validated against FrontApp API docs.
Unit test executed
Risks
None
Rollback steps
AI generated code
https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code