Skip to content

Commit 59cec84

Browse files
committed
Submission for source-bamboohr from Connector Builder
1 parent c803a45 commit 59cec84

File tree

7 files changed

+767
-0
lines changed

7 files changed

+767
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# BambooHR
2+
This directory contains the manifest-only connector for `source-bamboohr`.
3+
4+
The BambooHR source connector for Airbyte allows seamless extraction of HR data through multiple configurable streams, including `custom_reports_stream`, `employees_directory_stream`, `meta_fields_stream`, `time_off_requests_stream`, `timesheet_entries`, and `employees`.
5+
6+
## Usage
7+
There are multiple ways to use this connector:
8+
- You can use this connector as any other connector in Airbyte Marketplace.
9+
- You can load this connector in `pyairbyte` using `get_source`!
10+
- You can open this connector in Connector Builder, edit it, and publish to your workspaces.
11+
12+
Please refer to the manifest-only connector documentation for more details.
13+
14+
## Local Development
15+
We recommend you use the Connector Builder to edit this connector.
16+
17+
But, if you want to develop this connector locally, you can use the following steps.
18+
19+
### Environment Setup
20+
You will need `airbyte-ci` installed. You can find the documentation [here](airbyte-ci).
21+
22+
### Build
23+
This will create a dev image (`source-bamboohr:dev`) that you can use to test the connector locally.
24+
```bash
25+
airbyte-ci connectors --name=source-bamboohr build
26+
```
27+
28+
### Test
29+
This will run the acceptance tests for the connector.
30+
```bash
31+
airbyte-ci connectors --name=source-bamboohr test
32+
```
33+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference)
2+
# for more information about how to configure these tests
3+
connector_image: airbyte/source-bamboohr:dev
4+
acceptance_tests:
5+
spec:
6+
tests:
7+
- spec_path: "manifest.yaml"
8+
connection:
9+
bypass_reason: "This is a builder contribution, and we do not have secrets at this time"
10+
discovery:
11+
bypass_reason: "This is a builder contribution, and we do not have secrets at this time"
12+
basic_read:
13+
bypass_reason: "This is a builder contribution, and we do not have secrets at this time"
14+
incremental:
15+
bypass_reason: "This is a builder contribution, and we do not have secrets at this time"
16+
full_refresh:
17+
bypass_reason: "This is a builder contribution, and we do not have secrets at this time"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#
2+
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3+
#
4+
5+
from dataclasses import InitVar, dataclass
6+
from typing import Any, Mapping, Optional
7+
8+
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString
9+
from airbyte_cdk.sources.declarative.schema.schema_loader import SchemaLoader
10+
11+
12+
@dataclass
13+
class CustomFieldsSchemaLoader(SchemaLoader):
14+
config: Mapping[str, Any]
15+
default_schema_loader: Optional[SchemaLoader] = None
16+
fields_config_key: Optional[str] = None
17+
include_default_fields: Optional[bool] = False
18+
include_default_fields_config_key: Optional[bool] = False
19+
20+
def get_json_schema(self) -> Mapping[str, Any]:
21+
"""
22+
Returns the JSON schema.
23+
24+
The final schema is constructed by first generating a schema for the fields
25+
in the config and, if default fields should be included, adding these to the
26+
schema.
27+
"""
28+
schema = self._get_json_schema_from_config()
29+
if self.default_schema_loader and self._include_default_fields:
30+
default_schema = self.default_schema_loader.get_json_schema()
31+
schema = self._union_schemas(default_schema, schema)
32+
return schema
33+
34+
def _include_default_fields(self):
35+
if self.include_default_fields:
36+
return True
37+
else:
38+
return self.include_default_fields_config_key and self.config.get(self.include_default_fields_config_key, False)
39+
40+
def _get_json_schema_from_config(self):
41+
if self.fields_config_key and self.config.get(self.fields_config_key, None):
42+
properties = {
43+
field.strip(): {"type": ["null", "string"]}
44+
for field in self.convert_custom_reports_fields_to_list(self.config.get(self.fields_config_key))
45+
}
46+
else:
47+
properties = {}
48+
return {
49+
"$schema": "http://json-schema.org/draft-07/schema#",
50+
"type": "object",
51+
"properties": properties,
52+
}
53+
54+
def convert_custom_reports_fields_to_list(self, custom_reports_fields: str) -> list:
55+
return custom_reports_fields.split(",") if custom_reports_fields else []
56+
57+
def _union_schemas(self, schema1, schema2):
58+
schema1["properties"] = {**schema1["properties"], **schema2["properties"]}
59+
return schema1
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)