Skip to content

Commit cf1d7d2

Browse files
authored
fix: AltimateRefArgs extra fix (#32)
* AltimateRefArgs extra fix * use AltimateMacroArgument * change it for v11 * Add macro args test
1 parent d5115d3 commit cf1d7d2

File tree

6 files changed

+51543
-3
lines changed

6 files changed

+51543
-3
lines changed

src/datapilot/core/platforms/dbt/schemas/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class Config:
438438

439439
name: str
440440
type: Optional[Optional[str]] = None
441-
description: Optional[str] = ""
441+
description: Optional[Optional[str]] = ""
442442

443443

444444
AltimateSupportedLanguage = SupportedLanguage

src/datapilot/core/platforms/dbt/wrappers/manifest/v10/wrapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from datapilot.core.platforms.dbt.schemas.manifest import AltimateExternalTable
1616
from datapilot.core.platforms.dbt.schemas.manifest import AltimateFileHash
1717
from datapilot.core.platforms.dbt.schemas.manifest import AltimateFreshnessThreshold
18+
from datapilot.core.platforms.dbt.schemas.manifest import AltimateMacroArgument
1819
from datapilot.core.platforms.dbt.schemas.manifest import AltimateManifestColumnInfo
1920
from datapilot.core.platforms.dbt.schemas.manifest import AltimateManifestExposureNode
2021
from datapilot.core.platforms.dbt.schemas.manifest import AltimateManifestMacroNode
@@ -176,7 +177,7 @@ def _get_macro(self, macro: MacroNode) -> AltimateManifestMacroNode:
176177
meta=macro.meta,
177178
docs=macro.docs,
178179
patch_path=macro.patch_path,
179-
arguments=[AltimateRefArgs(**arg.dict()) for arg in macro.arguments] if macro.arguments else None,
180+
arguments=[AltimateMacroArgument(**arg.dict()) for arg in macro.arguments] if macro.arguments else None,
180181
created_at=macro.created_at,
181182
supported_languages=macro.supported_languages,
182183
)

src/datapilot/core/platforms/dbt/wrappers/manifest/v11/wrapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from datapilot.core.platforms.dbt.schemas.manifest import AltimateExternalTable
1616
from datapilot.core.platforms.dbt.schemas.manifest import AltimateFileHash
1717
from datapilot.core.platforms.dbt.schemas.manifest import AltimateFreshnessThreshold
18+
from datapilot.core.platforms.dbt.schemas.manifest import AltimateMacroArgument
1819
from datapilot.core.platforms.dbt.schemas.manifest import AltimateManifestColumnInfo
1920
from datapilot.core.platforms.dbt.schemas.manifest import AltimateManifestExposureNode
2021
from datapilot.core.platforms.dbt.schemas.manifest import AltimateManifestMacroNode
@@ -176,7 +177,7 @@ def _get_macro(self, macro: MacroNode) -> AltimateManifestMacroNode:
176177
meta=macro.meta,
177178
docs=macro.docs,
178179
patch_path=macro.patch_path,
179-
arguments=[AltimateRefArgs(**arg.dict()) for arg in macro.arguments] if macro.arguments else None,
180+
arguments=[AltimateMacroArgument(**arg.dict()) for arg in macro.arguments] if macro.arguments else None,
180181
created_at=macro.created_at,
181182
supported_languages=macro.supported_languages,
182183
)

tests/core/platform/dbt/test_cli.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,36 @@ def test_project_health_with_only_required_arg_version1_6():
5353
assert result.exit_code == 0 # Ensure the command executed successfully
5454
# Validate behavior for when only the required argument is provided
5555
assert "-----------" in result.output
56+
57+
58+
def test_project_health_with_macro_args():
59+
runner = CliRunner()
60+
manifest_path = "tests/data/manifest_v10macroargs.json"
61+
62+
# Simulate command invocation without optional arguments
63+
result = runner.invoke(
64+
project_health,
65+
[
66+
"--manifest-path",
67+
manifest_path,
68+
],
69+
)
70+
71+
assert result.exit_code == 0 # Ensure the command executed successfully
72+
# Validate behavior for when only the required argument is provided
73+
assert "-----------" in result.output
74+
75+
manifest_path = "tests/data/manifest_v11macroargs.json"
76+
77+
# Simulate command invocation without optional arguments
78+
result = runner.invoke(
79+
project_health,
80+
[
81+
"--manifest-path",
82+
manifest_path,
83+
],
84+
)
85+
86+
assert result.exit_code == 0 # Ensure the command executed successfully
87+
# Validate behavior for when only the required argument is provided
88+
assert "-----------" in result.output

0 commit comments

Comments
 (0)