Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openhexa/sdk/pipelines/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class IASOWidget(StrEnum):
"""Enum for IASO widgets."""

FORMS = "IASO_FORMS"
ORG_UNITS = "IASO_ORG_UNITS"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain, for future reference, why this was an issue ?

@nazarfil nazarfil May 14, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is parsing the ast and in case of an attribute we do a string compare to map it to correct widget:

elif isinstance(keyword.value, ast.Attribute):

So it is either enforce typing with enums and then make sure they are unique, or string check on the prefix

IASO_ORG_UNITS = "IASO_ORG_UNITS"
PROJECTS = "IASO_PROJECTS"


Expand Down
26 changes: 26 additions & 0 deletions tests/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ def test_pipeline_with_connection_parameter_for_iaso(self):
"from openhexa.sdk.pipelines.widgets import IASOWidget",
"",
"@parameter('iaso_con', name='IASO Connection', type=IASOConnection, required=True)",
"@parameter('org_units', name='OrgUnits', type=str, widget=IASOWidget.IASO_ORG_UNITS, connection='iaso_con', required=True)",
"@parameter('projects', name='Projects', type=str, widget=IASOWidget.PROJECTS, connection='iaso_con', required=True)",
"@parameter('forms', name='Forms', type=str, widget=IASOWidget.FORMS, connection='iaso_con', required=True)",
"@pipeline('Test pipeline')",
"def test_pipeline():",
Expand Down Expand Up @@ -525,6 +527,30 @@ def test_pipeline_with_connection_parameter_for_iaso(self):
"help": None,
"required": True,
},
{
"code": "org_units",
"type": "str",
"name": "OrgUnits",
"widget": IASOWidget.IASO_ORG_UNITS.value,
"connection": "iaso_con",
"default": None,
"multiple": False,
"choices": None,
"help": None,
"required": True,
},
{
"code": "projects",
"type": "str",
"name": "Projects",
"widget": IASOWidget.PROJECTS.value,
"connection": "iaso_con",
"default": None,
"multiple": False,
"choices": None,
"help": None,
"required": True,
},
{
"code": "forms",
"type": "str",
Expand Down