schema

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(field string, required []string) bool

func Format

func Format(field interface{}) string

func JSONBytesEqual

func JSONBytesEqual(a, b []byte) (bool, error)

JSONBytesEqual compares the JSON in two byte slices for deep equality, ignoring whitespace and other non-semantically meaningful formatting differences.

func Type

func Type(field interface{}) string

func Validate

func Validate(schema, document string) error

Validate exists to hide gojsonschema logic within this file it is the entry-point to validation logic, requiring the caller pass in valid json strings for each argument

func ValidateJSONSchema

func ValidateJSONSchema(maybeSchema JSONSchemaMap) error

ValidateJSONSchema takes in a string that is purported to be a JSON schema (schema definition) An error is returned if it is not a valid JSON schema, and nil is returned on success

Types

type JSONSchemaMap

type JSONSchemaMap map[string]interface{}

go representation of json schema document

func (JSONSchemaMap) AllowsAdditionalProperties

func (j JSONSchemaMap) AllowsAdditionalProperties() bool

func (JSONSchemaMap) Description

func (j JSONSchemaMap) Description() string

Assumes the json schema has a description field

func (JSONSchemaMap) Properties

func (j JSONSchemaMap) Properties() Properties

Assumes the json schema has a properties field

func (JSONSchemaMap) RequiredFields

func (j JSONSchemaMap) RequiredFields() []string

func (JSONSchemaMap) ToJSON

func (j JSONSchemaMap) ToJSON() string

type Properties

type Properties map[string]interface{}

Jump to

Keyboard shortcuts

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