Skip to content

Commit 4062d1b

Browse files
chore: Update CLAUDE.md
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent b7322e9 commit 4062d1b

1 file changed

Lines changed: 100 additions & 12 deletions

File tree

CLAUDE.md

Lines changed: 100 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document provides guidance for AI coding agents and developers working on t
77
- **Project Type**: Singer Tap
88
- **Source**: Greenhouse
99
- **Stream Type**: REST
10-
- **Authentication**: Basic Auth
10+
- **Authentication**: Basic Auth (V1) or OAuth2 (V3)
1111
- **Framework**: Meltano Singer SDK
1212

1313
## Architecture
@@ -19,7 +19,8 @@ This tap follows the Singer specification and uses the Meltano Singer SDK to ext
1919
1. **Tap Class** (`tap_greenhouse/tap.py`): Main entry point, defines streams and configuration
2020
1. **Client** (`tap_greenhouse/client.py`): Handles API communication and authentication
2121
1. **Streams** (`tap_greenhouse/streams.py`): Define data streams and their schemas
22-
## Development Guidelines for AI Agents
22+
23+
## Development Guidelines for AI Agents
2324

2425
### Understanding Singer Concepts
2526

@@ -45,25 +46,38 @@ Example:
4546
```python
4647
class MyNewStream(GreenhouseStream):
4748
name = "my_new_stream"
48-
path = "/api/v1/my_resource"
49+
path = "/my_resource"
4950
primary_keys = ["id"]
5051
replication_key = "updated_at"
5152

52-
schema = PropertiesList(
53-
Property("id", StringType, required=True),
54-
Property("name", StringType),
55-
Property("updated_at", DateTimeType),
53+
schema = th.PropertiesList(
54+
th.Property("id", th.IntegerType, required=True),
55+
th.Property("name", th.StringType),
56+
th.Property("updated_at", th.DateTimeType),
5657
).to_dict()
5758
```
5859

5960
#### Modifying Authentication
6061

61-
- Username/password in config
62-
- Automatically encoded to base64
63-
#### Handling Pagination
62+
This tap supports two authentication methods:
63+
64+
**V1 Basic Auth:**
65+
- API key stored in `api_key` config property
66+
- Passed via Basic Auth header with API key as username, blank password
67+
- Use `GreenhouseBasicAuthenticator` class
68+
69+
**V3 OAuth2:**
70+
- Client credentials stored in `client_key` and `client_secret` config properties
71+
- Implements OAuth2 client credentials flow
72+
- Use `GreenhouseOAuthAuthenticator` class
73+
- Requires scopes to be configured in Greenhouse Dev Center
74+
75+
#### Handling Pagination
6476

6577
The SDK provides built-in pagination classes. **Use these instead of overriding `get_next_page_token()` directly.**
6678

79+
This tap uses a custom `GreenhouseLinkHeaderPaginator` that parses RFC 5988 Link headers.
80+
6781
**Built-in Paginator Classes:**
6882

6983
1. **SimpleHeaderPaginator**: For APIs using Link headers (RFC 5988)
@@ -200,6 +214,79 @@ tap-greenhouse --config config.json --discover
200214
tap-greenhouse --config config.json --catalog catalog.json
201215
```
202216

217+
### Keeping meltano.yml and Tap Settings in Sync
218+
219+
When this tap is used with Meltano, the settings defined in `meltano.yml` must stay in sync with the `config_jsonschema` in the tap class. Configuration drift between these two sources causes confusion and runtime errors.
220+
221+
**When to sync:**
222+
223+
- Adding new configuration properties to the tap
224+
- Removing or renaming existing properties
225+
- Changing property types, defaults, or descriptions
226+
- Marking properties as required or secret
227+
228+
**How to sync:**
229+
230+
1. Update `config_jsonschema` in `tap_greenhouse/tap.py`
231+
1. Update the corresponding `settings` block in `meltano.yml`
232+
1. Update `.env.example` with the new environment variable
233+
234+
Example - adding a new `batch_size` setting:
235+
236+
```python
237+
# tap_greenhouse/tap.py
238+
config_jsonschema = th.PropertiesList(
239+
th.Property("api_url", th.StringType, required=True),
240+
th.Property("api_key", th.StringType, required=True, secret=True),
241+
th.Property("batch_size", th.IntegerType, default=100), # New setting
242+
).to_dict()
243+
```
244+
245+
```yaml
246+
# meltano.yml
247+
plugins:
248+
extractors:
249+
- name: tap-greenhouse
250+
settings:
251+
- name: api_url
252+
kind: string
253+
- name: api_key
254+
kind: string
255+
sensitive: true
256+
- name: batch_size # New setting
257+
kind: integer
258+
value: 100
259+
```
260+
261+
```bash
262+
# .env.example
263+
TAP_GREENHOUSE_API_URL=https://api.example.com
264+
TAP_GREENHOUSE_API_KEY=your_api_key_here
265+
TAP_GREENHOUSE_BATCH_SIZE=100 # New setting
266+
```
267+
268+
**Setting kind mappings:**
269+
270+
| Python Type | Meltano Kind |
271+
|-------------|--------------|
272+
| `StringType` | `string` |
273+
| `IntegerType` | `integer` |
274+
| `BooleanType` | `boolean` |
275+
| `NumberType` | `number` |
276+
| `DateTimeType` | `date_iso8601` |
277+
| `ArrayType` | `array` |
278+
| `ObjectType` | `object` |
279+
280+
Any properties with `secret=True` should be marked with `sensitive: true` in `meltano.yml`.
281+
282+
**Best practices:**
283+
284+
- Always update all three files (`tap.py`, `meltano.yml`, `.env.example`) in the same commit
285+
- Use the same default values in all locations
286+
- Keep descriptions consistent between code docstrings and `meltano.yml` `description` fields
287+
288+
> **Note:** This guidance is consistent with target and mapper templates in the Singer SDK. See the [SDK documentation](https://sdk.meltano.com) for canonical reference.
289+
203290
### Common Pitfalls
204291

205292
1. **Rate Limiting**: Implement backoff using `RESTStream` built-in retry logic
@@ -238,9 +325,9 @@ tap-greenhouse/
238325
├── tests/
239326
│ ├── __init__.py
240327
│ └── test_core.py
241-
├── config.json # Example configuration
328+
├── meltano.yml # Meltano configuration
242329
├── pyproject.toml # Dependencies and metadata
243-
└── README.md # User documentation
330+
└── README.md # User documentation
244331
```
245332

246333
## Additional Resources
@@ -249,6 +336,7 @@ tap-greenhouse/
249336
- Singer SDK: https://sdk.meltano.com
250337
- Meltano: https://meltano.com
251338
- Singer Specification: https://hub.meltano.com/singer/spec
339+
- Greenhouse Harvest API: https://developers.greenhouse.io/harvest.html
252340

253341
## Making Changes
254342

0 commit comments

Comments
 (0)