Skip to content

Commit

Permalink
Remove the project type when submitting updates to pyxis
Browse files Browse the repository at this point in the history
Signed-off-by: Jose R. Gonzalez <jose@flutes.dev>
  • Loading branch information
komish committed Aug 18, 2022
1 parent 8a685ae commit 4c11c2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
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{
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
}

type Container struct {
Expand Down

0 comments on commit 4c11c2a

Please sign in to comment.