jsonschema

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertJsonToMap

func ConvertJsonToMap(jsonData string) (map[string]string, error)

func ConvertMapToJson

func ConvertMapToJson(data map[string]string) ([]byte, error)

func GenerateUniqueKeyForValues

func GenerateUniqueKeyForValues(data map[string]string, keyNames []string) (string, error)

Generates unique SHA256 based unique key for the values in the map for the given keys

func ValidateMap

func ValidateMap[T any](schema *jsonschema.Schema, data map[string]T) error

New function for validating map with generic type parameter

Types

type JsonSchemaValidator

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

func NewJsonSchemaValidator

func NewJsonSchemaValidator(schemaDirectory string) (*JsonSchemaValidator, error)

func (*JsonSchemaValidator) GetUniqueKeys

func (v *JsonSchemaValidator) GetUniqueKeys(schemaId string) ([]string, error)

func (*JsonSchemaValidator) ValidateJson

func (v *JsonSchemaValidator) ValidateJson(schemaId string, jsonObject any) error

func (*JsonSchemaValidator) ValidateMap

func (v *JsonSchemaValidator) ValidateMap(schemaId string, data map[string]any) error

Jump to

Keyboard shortcuts

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