jsonschematestsuite

package
v0.0.0-...-6bdfa54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package jsonschematestsuite exposes test cases from the official [JSON Schema test suite](github.com/json-schema-org/JSON-Schema-Test-Suite) for use in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name string `json:"-"`

	Groups []*Group // call Read to populate this field
	// contains filtered or unexported fields
}

File is a file of test groups from the JSON Schema test suite.

func Files

func Files(internalDir string) (files []File, err error)

Files returns all test files from the JSON Schema official test suite and this library's own test suite.

func (*File) Read

func (f *File) Read() error

Read reads and unmarshals the test file from disk.

func (*File) ReadT

func (f *File) ReadT(t testing.TB)

ReadT wraps the Read method for easier use in tests. It calls t.Fatal(err) if Read returns an error.

type Group

type Group struct {
	Description string
	RawSchema   json.RawMessage    `json:"schema"`
	Schema      *jsonschema.Schema `json:"-"`
	Tests       []TestCase
}

Group is a group of test cases from the JSON Schema test suite.

type TestCase

type TestCase struct {
	Description string
	Data        json.RawMessage
	Valid       bool
}

TestCase is a test case from the JSON Schema test suite.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL