Skip to content

Support all attributes kind in protocols #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions infrahub_sdk/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def _jinja2_filter_inheritance(value: dict[str, Any]) -> str:
def _jinja2_filter_render_attribute(value: AttributeSchema) -> str:
attribute_kind_map = {
"boolean": "Boolean",
"checkbox": "Checkbox",
"datetime": "DateTime",
"dropdown": "Dropdown",
"hashedpassword": "HashedPassword",
Expand Down
2 changes: 2 additions & 0 deletions infrahub_sdk/ctl/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
IntegerOptional,
Boolean,
BooleanOptional,
Checkbox,
CheckboxOptional,
DateTime,
DateTimeOptional,
Dropdown,
Expand Down
8 changes: 8 additions & 0 deletions infrahub_sdk/protocols_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
value: Optional[bool]


class Checkbox(Attribute):
value: bool

Check warning on line 57 in infrahub_sdk/protocols_base.py

View check run for this annotation

Codecov / codecov/patch

infrahub_sdk/protocols_base.py#L56-L57

Added lines #L56 - L57 were not covered by tests


class CheckboxOptional(Attribute):
value: Optional[bool]

Check warning on line 61 in infrahub_sdk/protocols_base.py

View check run for this annotation

Codecov / codecov/patch

infrahub_sdk/protocols_base.py#L60-L61

Added lines #L60 - L61 were not covered by tests


class DateTime(Attribute):
value: str

Expand Down