dlt-hub / dlt

data load tool (dlt) is an open source Python library that makes data loading easy 🛠️
https://dlthub.com/docs
Apache License 2.0
2.65k stars 176 forks source link

rest_api: Suggest renaming `resolve` to `reference` in dependent resources #1873

Open burnash opened 1 month ago

burnash commented 1 month ago

Background

In the current rest_api source configuration, the "resolve" keyword is used to link resources and fields across endpoints:

{
    "client": {
        # ...
    },
    "resources": [
        {
            "name": "issues",
            "endpoint": {
                "path": "issues",
                "params": {
                    "since": {
                        "type": "incremental",
                        "cursor_path": "updated_at",
                        "initial_value": "2024-01-25T11:21:28Z",
                    },
                },
            },
        },
        {
            "name": "issue_comments",
            "endpoint": {
                "path": "issues/{issue_number}/comments",
                "params": {
                    "issue_number": {
                        "type": "resolve",                               # <-- This
                        "resource": "issues",
                        "field": "number",
                    }
                },
            },
        },
    ],
}

Proposal

I suggest renaming "resolve" to "reference" for improved clarity and better alignment with its function:

{
    "client": {
        # ...
    },
    "resources": [
        {
            "name": "issues",
            "endpoint": {
                "path": "issues",
                "params": {
                    "since": {
                        "type": "incremental",
                        "cursor_path": "updated_at",
                        "initial_value": "2024-01-25T11:21:28Z",
                    },
                },
            },
        },
        {
            "name": "issue_comments",
            "endpoint": {
                "path": "issues/{issue_number}/comments",
                "params": {
                    "issue_number": {
                        "type": "reference",                               # <-- To this
                        "resource": "issues",
                        "field": "number",
                    }
                },
            },
        },
    ],
}