jsonschema

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hydrate

func Hydrate(ctx context.Context, anyVal interface{}, cwd string, c *client.MassdriverClient) (interface{}, error)

func Loader

func Loader(path string) gojsonschema.JSONLoader

Load a JSON Schema with or without a path prefix

func Validate

func Validate(schemaPath string, documentPath string) (*gojsonschema.Result, error)

Validate the input object against the schema

func WriteDereferencedSchema

func WriteDereferencedSchema(schemaFilePath string, outFile io.Writer, c *client.MassdriverClient) error

Types

type GenerateAuthFile

type GenerateAuthFile struct {
	Format   string  `json:"format"`
	Template *string `json:"template,omitempty"`
}

type PropertiesMap

type PropertiesMap map[string]Property

PropertiesMap is a named map of Property

type Property

type Property struct {
	AdditionalProperties bool              `json:"additionalProperties"`
	Type                 string            `json:"type"`
	Items                *Property         `json:"items"`
	Properties           PropertiesMap     `json:"properties,omitempty"`
	GenerateAuthFile     *GenerateAuthFile `json:"md.generateAuthFile,omitempty"`
}

Property is a single JSON Schema property field

type RefdSchema

type RefdSchema struct {
	SchemaID   string
	Definition interface{}
}

A RefdSchema is a JSON Schema that may contain $ref

func (*RefdSchema) Type

func (r *RefdSchema) Type() string

type Schema

type Schema struct {
	Properties PropertiesMap `json:"properties"`
	Required   []string      `json:"required,omitempty"`
}

Schema is a flimsy representation of a JSON Schema. It provides just enough structure to get type information.

func GetJSONSchema

func GetJSONSchema(path string) (Schema, error)

Jump to

Keyboard shortcuts

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