-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Source BambooHR: Add custom fields validation (#16826)
* Add custom fields validation * Updated PR number * Deleted employees_directory_stream * Fix tests * auto-bump connector version [ci skip] * Updated docs * Updated changelog Co-authored-by: Octavia Squidington III <[email protected]>
- Loading branch information
1 parent
8945f16
commit f10550a
Showing
11 changed files
with
160 additions
and
27 deletions.
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
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
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
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
10 changes: 0 additions & 10 deletions
10
airbyte-integrations/connectors/source-bamboo-hr/integration_tests/configured_catalog.json
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
24 changes: 24 additions & 0 deletions
24
airbyte-integrations/connectors/source-bamboo-hr/source_bamboo_hr/exception.py
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
|
||
class BambooHrError(Exception): | ||
message = "" | ||
|
||
def __init__(self): | ||
super().__init__(self.message) | ||
|
||
|
||
class NullFieldsError(BambooHrError): | ||
message = "Field `custom_reports_fields` cannot be empty if `custom_reports_include_default_fields` is false." | ||
|
||
|
||
class AvailableFieldsAccessDeniedError(BambooHrError): | ||
message = "You hasn't access to any report fields. Please check your access level." | ||
|
||
|
||
class CustomFieldsAccessDeniedError(Exception): | ||
def __init__(self, denied_fields): | ||
self.message = f"Access to fields: {', '.join(denied_fields)} - denied. Please check your access level." | ||
super().__init__(self.message) |
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
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
17 changes: 17 additions & 0 deletions
17
airbyte-integrations/connectors/source-bamboo-hr/source_bamboo_hr/utils.py
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
|
||
def convert_custom_reports_fields_to_list(custom_reports_fields: str) -> list: | ||
return custom_reports_fields.split(",") if custom_reports_fields else [] | ||
|
||
|
||
def validate_custom_fields(custom_fields, available_fields): | ||
denied_fields = [] | ||
for custom_field in custom_fields: | ||
has_access_to_custom_field = any(available_field.get("Name") == custom_field for available_field in available_fields) | ||
if not has_access_to_custom_field: | ||
denied_fields.append(custom_field) | ||
|
||
return denied_fields |
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
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