schema

package
v0.0.0-...-7ababc3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package schema contains code for working with JSON schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MisspelledOptionalPropertyFound

func MisspelledOptionalPropertyFound(validationResult ValidationResult) bool

MisspelledOptionalPropertyFound returns whether a misspelled optional property was found.

func ProhibitedAdditionalProperties

func ProhibitedAdditionalProperties(propertyName string, validationResult ValidationResult) bool

ProhibitedAdditionalProperties returns whether the given property has prohibited additional subproperty(s).

func PropertyDependenciesMissing

func PropertyDependenciesMissing(propertyName string, validationResult ValidationResult) bool

PropertyDependenciesMissing returns whether property dependencies of the given property are missing.

func PropertyEnumMismatch

func PropertyEnumMismatch(propertyName string, validationResult ValidationResult) bool

PropertyEnumMismatch returns whether the given property does not match any of the items in the enum array.

func PropertyFormatMismatch

func PropertyFormatMismatch(propertyName string, validationResult ValidationResult) bool

PropertyFormatMismatch returns whether the given property has incorrect format.

func PropertyGreaterThanMaxLength

func PropertyGreaterThanMaxLength(propertyName string, validationResult ValidationResult) bool

PropertyGreaterThanMaxLength returns whether the given property is greater than the maximum length allowed by the schema.

func PropertyLessThanMinLength

func PropertyLessThanMinLength(propertyName string, validationResult ValidationResult) bool

PropertyLessThanMinLength returns whether the given property is less than the minimum length allowed by the schema.

func PropertyPatternMismatch

func PropertyPatternMismatch(propertyName string, validationResult ValidationResult) bool

PropertyPatternMismatch returns whether the given property did not match the regular expression defined in the JSON schema.

func PropertyTypeMismatch

func PropertyTypeMismatch(propertyName string, validationResult ValidationResult) bool

PropertyTypeMismatch returns whether the given property has incorrect type.

func RequiredPropertyMissing

func RequiredPropertyMissing(propertyName string, validationResult ValidationResult) bool

RequiredPropertyMissing returns whether the given required property is missing from the document.

func ValidationErrorMatch

func ValidationErrorMatch(
	instancePointerQuery,
	schemaPointerQuery,
	schemaPointerValueQuery,
	failureContextQuery string,
	validationResult ValidationResult,
) bool

ValidationErrorMatch returns whether the given query matches against the JSON schema validation error. See: https://godoc.org/github.com/ory/jsonschema#ValidationError

Types

type Schema

type Schema struct {
	Compiled *jsonschema.Schema
	// contains filtered or unexported fields
}

Schema is the type of the compiled JSON schema object.

func Compile

func Compile(schemaFilename string, referencedSchemaFilenames []string, dataLoader dataLoaderType) Schema

Compile compiles the schema files specified by the filename arguments and returns the compiled schema.

type ValidationResult

type ValidationResult struct {
	Result *jsonschema.ValidationError
	// contains filtered or unexported fields
}

ValidationResult is the type of the result of the validation of the instance document against the JSON schema.

func Validate

func Validate(instanceInterface map[string]interface{}, schemaObject Schema) ValidationResult

Validate validates an instance against a JSON schema and returns nil if it was success, or the jsonschema.ValidationError object otherwise.

Directories

Path Synopsis
Package compliancelevel defines the levels of specification compliance.
Package compliancelevel defines the levels of specification compliance.
Package schemadata Code generated by go-bindata.
Package schemadata Code generated by go-bindata.

Jump to

Keyboard shortcuts

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