Skip to content

Commit

Permalink
Fix JSON field name / Detailed err message
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Mar 29, 2023
1 parent 7f72795 commit 1fd3200
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/api/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type DevfileStack struct {
}

type DevfileStackVersion struct {
Version string `json:"version,omitempty"`
IsDefault bool `json:"isDefault"`
SchemaVersion string `json:"schemaVersion,omitempty"`
StarterProjects []string `json:"starterProjects"`
CommandGroups map[schema.CommandGroupKind]bool
Version string `json:"version,omitempty"`
IsDefault bool `json:"isDefault"`
SchemaVersion string `json:"schemaVersion,omitempty"`
StarterProjects []string `json:"starterProjects"`
CommandGroups map[schema.CommandGroupKind]bool `json:"commandGroups"`
}
3 changes: 1 addition & 2 deletions pkg/odo/cli/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package registry

import (
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -272,5 +271,5 @@ func getVersion(stack api.DevfileStack, v string) (api.DevfileStackVersion, erro
return version, nil
}
}
return api.DevfileStackVersion{}, errors.New("version not found")
return api.DevfileStackVersion{}, fmt.Errorf("version %q not found in Devfile stack for %q", v, stack.Name)
}
4 changes: 2 additions & 2 deletions tests/integration/cmd_devfile_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var _ = Describe("odo devfile registry command tests", func() {
helper.JsonPathContentContain(stdout, "0.projectType", "Node.js")
helper.JsonPathContentContain(stdout, "0.devfileData.devfile.metadata.name", "nodejs")
helper.JsonPathContentContain(stdout, "0.devfileData.supportedOdoFeatures.dev", "true")
helper.JsonPathContentContain(stdout, "0.versions.0.CommandGroups.run", "true")
helper.JsonPathContentContain(stdout, "0.versions.0.commandGroups.run", "true")

defaultVersion := gjson.Get(stdout, "0.version").String()
By("returning backward-compatible information linked to the default stack version", func() {
Expand Down Expand Up @@ -274,7 +274,7 @@ spec:
helper.JsonPathContentContain(stdout, "0.projectType", "Node.js")
helper.JsonPathContentContain(stdout, "0.devfileData.devfile.metadata.name", "nodejs")
helper.JsonPathContentContain(stdout, "0.devfileData.supportedOdoFeatures.dev", "true")
helper.JsonPathContentContain(stdout, "0.versions.0.CommandGroups.run", "true")
helper.JsonPathContentContain(stdout, "0.versions.0.commandGroups.run", "true")

defaultVersion := gjson.Get(stdout, "0.version").String()
By("returning backward-compatible information linked to the default stack version", func() {
Expand Down

0 comments on commit 1fd3200

Please sign in to comment.