-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add ability to construct HFIDs from payload for upsert mutations #4339
Conversation
4abbc06
to
f19d60a
Compare
|
||
hfid: list[str] = [] | ||
for component in node_schema.human_friendly_id: | ||
name, hfid_value = component.split("__", maxsplit=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use node_schema.parse_schema_path
here to get a SchemaAttributePath
that includes the relationship schema, related schema, attribute_schema, and attribute_property_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this and also removed the initial data.get(). All good with the changes now?
f19d60a
to
573efc2
Compare
573efc2
to
7a23193
Compare
This adds to the
MutationNodeGetterByHfid
class so that it attempts to construct an HFID based on the payload of the mutation. This is done by looking at how the HFID for the object should be constructed and then see if we have enough information within the payload to create an HFID.I've not looked too closely at the HFIDs before the implementation here is done with the assumption that there are two kinds of HFID components
name__value
device__name__value
I've also changed the SDK so that it doesn't attempt to send in hfid if any of the fields are missing. The current behaviour was to convert the
None
value into the string "None". I don't know if there is a scenario where we actually want part of the htid to be the string "None", but that part seems wrong.Fixes opsmill/infrahub-sdk-python#45