Skip to content

Commit

Permalink
Make spec and api checks clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
mproffitt committed Jul 23, 2024
1 parent c5fd834 commit 43dbed1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/crd/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ func ParsePromise(iface any, crd *apiextensionsv1.CustomResourceDefinition) (err
crdYAMLBytes []byte
)

if spec, ok = iface.(map[string]any)["spec"].(map[string]any); !ok {
spec, ok = iface.(map[string]any)["spec"].(map[string]any)
if !ok {
return microerror.Maskf(CouldNotParseCRDFileError, "kratix promise is missing its spec")
}

if api, ok = spec["api"].(map[string]any); !ok {
api, ok = spec["api"].(map[string]any)
if !ok {
return microerror.Maskf(CouldNotParseCRDFileError, "kratix promise is missing its spec.api")
}

Expand Down

0 comments on commit 43dbed1

Please sign in to comment.