Skip to content
This repository was archived by the owner on Sep 18, 2021. It is now read-only.

Commit 7a47238

Browse files
committed
fix(cli): fix validation command
1 parent afdc368 commit 7a47238

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

commands/validate.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package commands
33
import (
44
"fmt"
55
"os"
6+
"path/filepath"
67

78
"github.com/spf13/cobra"
89

@@ -19,14 +20,21 @@ var Validate = &cobra.Command{
1920
Args: cobra.ExactArgs(1),
2021
Run: func(cmd *cobra.Command, args []string) {
2122
var collectionDir, err = ansible.GetStackHeadCollectionLocation()
23+
collectionAbsDir, err := filepath.Abs(collectionDir)
24+
if err != nil {
25+
panic(err)
26+
return
27+
}
28+
29+
schemaPath := filepath.Join(collectionAbsDir, "schema", "project-definition.schema.json")
2230
if err != nil {
2331
_, err = fmt.Fprintf(os.Stderr, "%s\n", err.Error())
2432
if err != nil {
2533
panic(err)
2634
}
2735
return
2836
}
29-
result, err := jsonschema.ValidateFile(collectionDir, args[0])
37+
result, err := jsonschema.ValidateFile(args[0], schemaPath)
3038

3139
if err != nil {
3240
panic(err.Error())

0 commit comments

Comments
 (0)