func Files(internalDir string) (files []File, err error) {
	officialTestSuiteDir := filepath.Join(internalDir, "jsonschematestsuite", "testdata", "official")
	if _, err := os.Stat(filepath.Join(officialTestSuiteDir, "tests")); os.IsNotExist(err) {
		return nil, fmt.Errorf("missing git submodule, run \"git submodule init && git submodule update\": %w", err)
	}
	for _, root := range []string{
		filepath.Join(internalDir, "jsonschematestsuite", "testdata"),
		filepath.Join(officialTestSuiteDir, "tests", "draft7"),
	} {
		err = filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
			if path == officialTestSuiteDir {
				return filepath.SkipDir
			}
			if err != nil {
				return err
			}
			if !info.Mode().IsRegular() || filepath.Ext(info.Name()) != ".json" {
				return nil
			}
			files = append(files, File{
				Name: strings.TrimSuffix(strings.TrimPrefix(path, root+string(os.PathSeparator)), ".json"),
				path: path,
			})
			return nil
		})
		if err != nil {
			return nil, err
		}
	}
	return files, err
}
Files returns all test files from the JSON Schema official test suite and this library's own test
suite.
package jsonschematestsuite
import (
	"encoding/json"
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"testing"
	"github.com/sourcegraph/go-jsonschema/jsonschema"
)
type File struct {
	Name string `json:"-"`
	path string
	Groups []*Group  
}
func (f *File) Read() error {
	f2, err := os.Open(f.path)
	if err != nil {
		return err
	}
	defer f2.Close()
	if err := json.NewDecoder(f2).Decode(&f.Groups); err != nil {
		return err
	}
	for _, g := range f.Groups {
		if err := json.Unmarshal(g.RawSchema, &g.Schema); err != nil {
			return err
		}
	}
	return nil
}
func (f *File) ReadT(t testing.TB) {
	t.Helper()
	if err := f.Read(); err != nil {
		t.Fatal(err)
	}
}
type Group struct {
	Description string
	RawSchema   json.RawMessage    `json:"schema"`
	Schema      *jsonschema.Schema `json:"-"`
	Tests       []TestCase
}
type TestCase struct {
	Description string
	Data        json.RawMessage
	Valid       bool
}