-
Notifications
You must be signed in to change notification settings - Fork 35
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
Consume top level variables & attributes #82
Conversation
Signed-off-by: Maysun J Faisal <[email protected]>
Signed-off-by: Maysun J Faisal <[email protected]>
} | ||
|
||
// UpdateAttributes updates the devfile top level attributes | ||
func (d *DevfileV2) UpdateAttributes(attr attributes.Attributes) error { |
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.
so update attributes is going to replace the entire top-level attribute?
or should just we update for a specific key?
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.
ok, I will look for the specfic key for update
} else if err == nil { | ||
attributes, err := tt.devfilev2.GetAttributes() | ||
if err != nil { | ||
t.Errorf("TestUpdateAttributes error2 - %+v", err) |
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.
return after this error
wantAttributes: attributes.Attributes{}.PutString("key1", "value1").Put("key3", nestedValue, nil).PutString("key2", "value2"), | ||
}, | ||
{ | ||
name: "If Schema 2.1.0 has an attribute already present, it should overwrite", |
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'm not sure if this is an expected behavior for add
if you check for other update & add functions for commands/components/projects etc., this should be an update behavior. for "add", if the key exist, should return an error?
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.
Will do these modifications:
update will look for a specific key, err out if absent
add will just add a new key, since attributes is a map if there is a key already present, it will just overwrite with the new value
Signed-off-by: Maysun J Faisal <[email protected]>
Looks good to me |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maysunfaisal, yangcao77 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Maysun J Faisal [email protected]
What does this PR do?
What issues does this PR fix or reference?
Fixes devfile/api#351
Is your PR tested? Consider putting some instruction how to test your changes
New go tests