jsonschema

package
v0.6.0-rc.6a Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONSchema = &Schema{}

Functions

This section is empty.

Types

type Schema

type Schema struct {
	jsonschema.Schema
	Lock sync.Mutex
}

func GlobalJSONSchema

func GlobalJSONSchema() *Schema

This approach is bad, and we are not the ones implementing this. The qri-io/jsonschema internally is creating a global instance of Schema. Hence for concurrent operations, we have to make sure that the package qri-io/jsonschema is accessed in a thread-safe way. So use this Global instance for now.

func (*Schema) ValidateBytes

func (s *Schema) ValidateBytes(ctx context.Context, data []byte) ([]jsonschema.KeyError, error)

JsonSchema package creates a global instance(without any locks) of Schema struct which panics when concurrent routines try to call ValidateBytes. So this package creates a thin shim to avoid internal concurrent map writes

Jump to

Keyboard shortcuts

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