validator

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package validator implements a STAC resource validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Limit to the number of resources to fetch and validate concurrently.
	Concurrency int

	// Set to true to validate a single resource and avoid validating all linked resources.
	NoRecursion bool

	// A lookup of substitute schema locations.  The key is the original schema location
	// and the value is the substitute location.
	SchemaMap map[string]string

	// Logger to use for logging.
	Logger *logr.Logger
}

Options for the Validator.

type ValidationError

type ValidationError struct {
	*jsonschema.ValidationError

	// Location is the file path or URL to the resource that failed validation.
	Location string

	// The resource being crawled.
	Resource crawler.Resource
}

ValidationError holds details about a validation error.

func (*ValidationError) GoString

func (err *ValidationError) GoString() string

GoString provides additional detail about the validation error.

Called when the # flag is used with the %v verb as in fmt.Printf("%#v", err).

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator allows validation of STAC resources.

func New

func New(options ...*Options) *Validator

New creates a new Validator.

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, resource string) error

Validate validates a STAC resource.

The resource can be a path to a local file or a URL. Validation will stop with the first invalid resource and the resulting ValidationError will be returned. Context cancellation will also stop validation and the context error will be returned.

Jump to

Keyboard shortcuts

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