schema

package
v0.0.0-...-674084c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package schema is an adapter from https://github.com/xeipuuv/gojsonschema to the jk runtime, so that validation via JSON Schema can be built into the standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Msg  string `json:"msg"`
	Path string `json:"path"`
}

Error is a struct that will serialise as JSON neatly, to be rehydrated as a validation error by the RPC wrapper in JavaScript.

func ValidateWithFile

func ValidateWithFile(valueStr string, vfs http.FileSystem, p string) ([]Error, error)

ValidateWithFile validates a value (as JSON stringified) against the schema at the path given.

func ValidateWithObject

func ValidateWithObject(valueStr, schemaStr string) ([]Error, error)

ValidateWithObject validates a value against a schema. Both arguments are supplied as strings, since they will be passed as strings via RPC anyway.

Jump to

Keyboard shortcuts

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