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

Remove the project type when submitting updates to pyxis #768

Merged
merged 1 commit into from
Aug 18, 2022
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
14 changes: 13 additions & 1 deletion certification/pyxis/pyxis.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,19 @@ func (p *pyxisClient) GetProject(ctx context.Context) (*CertProject, error) {
}

func (p *pyxisClient) updateProject(ctx context.Context, certProject *CertProject) (*CertProject, error) {
b, err := json.Marshal(certProject)
// We cannot send the project type to pyxis in a Patch.
// Copy the CertProject and strip the Type value to
// have omitempty skip the key in the JSON patch.
patchCertProject := &CertProject{
komish marked this conversation as resolved.
Show resolved Hide resolved
ID: certProject.ID,
CertificationStatus: certProject.CertificationStatus,
Container: certProject.Container,
Name: certProject.Name,
ProjectStatus: certProject.ProjectStatus,
// Do not copy the Type.
}

b, err := json.Marshal(patchCertProject)
if err != nil {
return nil, fmt.Errorf("could not marshal certProject: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions certification/pyxis/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ type CertProject struct {
ID string `json:"_id,omitempty"`
CertificationStatus string `json:"certification_status" default:"In Progress"`
Container Container `json:"container"`
Name string `json:"name"` // required
ProjectStatus string `json:"project_status"` // required
Type string `json:"type" default:"Containers"` // required
Name string `json:"name"` // required
ProjectStatus string `json:"project_status"` // required
Type string `json:"type,omitempty"` // required
Comment on lines -102 to +104
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A note to reviewers: These lines all changed because the comment's alignment changed.

}

type Container struct {
Expand Down