Skip to content
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

feature: Be able to rebuild the HFID from a dictionary for a given node #267

Open
BeArchiTek opened this issue Feb 11, 2025 · 0 comments
Open
Labels
priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release state/need-triage This issue needs to be triaged type/feature New feature or request

Comments

@BeArchiTek
Copy link
Contributor

Component

Python SDK

Describe the Feature Request

As a user, I want to be able to rebuild an HFID based on an input Dictionary.

Describe the Use Case

In the Ansible collection, I have to rebuild the HFID if it is is not provided to avoid forcing the users to set it explicitly if they do not give me all the right fields.

For that,t I created :

def rebuild_hfid_from_data(self, schema: NodeSchemaAPI | GenericSchemaAPI | ProfileSchemaAPI, data: dict) -> list[str] | None:
            """
            Rebuild the HFID filters from the provided data based on the schema's human_friendly_id.
            """
            hfid_values = []
            # Iterate over each composite key defined in the schema.
            for composite in schema.human_friendly_id:
                # Split the composite key into individual field names.
                element = composite.split("__")[0]
                value = data.get(element)
                if value is None:
                    return None
                hfid_values.append(str(value))
            return hfid_values

It should be improved as there is no extra verification like if there are 2 attributes for a related node (name and description)

Additional Information

No response

@BeArchiTek BeArchiTek added the type/feature New feature or request label Feb 11, 2025
@exalate-issue-sync exalate-issue-sync bot added state/need-triage This issue needs to be triaged priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release labels Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release state/need-triage This issue needs to be triaged type/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant