|
|
@ -5,9 +5,7 @@ package cmd
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"log"
|
|
|
|
"log"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/santhosh-tekuri/jsonschema/v5"
|
|
|
|
"github.com/santhosh-tekuri/jsonschema/v5"
|
|
|
@ -16,19 +14,6 @@ import (
|
|
|
|
"gopkg.in/yaml.v3"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func LoadURL(s string) (io.ReadCloser, error) {
|
|
|
|
|
|
|
|
u, err := url.Parse(s)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
loader, ok := jsonschema.Loaders[u.Scheme]
|
|
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
|
|
return nil, jsonschema.LoaderNotFoundError(s)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return loader(s)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// rootCmd represents the base command when called without any subcommands
|
|
|
|
// rootCmd represents the base command when called without any subcommands
|
|
|
|
var validateCmd = &cobra.Command{
|
|
|
|
var validateCmd = &cobra.Command{
|
|
|
|
Use: "validate",
|
|
|
|
Use: "validate",
|
|
|
|