schema

package
v0.1.84 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 10 Imported by: 2

README

JSON schema generator

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectDefinitions added in v0.1.83

func CollectDefinitions(s []byte, confDefs map[string]*ajson.Node, filter FilterFunction) error

func CreateSchema

func CreateSchema(m interface{}) (jsonschema.Schema, error)

func CreateSchemaAndData added in v0.1.35

func CreateSchemaAndData(m interface{}) ([]byte, []byte, error)

func GetBool added in v0.1.84

func GetBool(param string, v *ajson.Node) (bool, bool)

func GetDefinitionName added in v0.1.78

func GetDefinitionName(t reflect.Type) string

func GetInt added in v0.1.84

func GetInt(param string, v *ajson.Node) (int, bool)

func GetStr added in v0.1.84

func GetStr(param string, v *ajson.Node) (string, bool)

func SetBool added in v0.1.84

func SetBool(param string, val bool, v *ajson.Node) error

func SetInt added in v0.1.84

func SetInt(param string, val int, v *ajson.Node) error

func SetStr added in v0.1.84

func SetStr(param string, val string, v *ajson.Node) error

func UpdateWithDefinitions added in v0.1.83

func UpdateWithDefinitions(realSchema []byte, configurableDefinitionNodes map[string]*ajson.Node) ([]byte, error)

UpdateWithDefinitions parses schema and update all definitions in it by using map of ajson.nodes definitions replacing preserves path and configurable properties

Types

type FilterFunction added in v0.1.84

type FilterFunction func(node *ajson.Node) bool
var FilterConfigurable FilterFunction = func(node *ajson.Node) bool {
	configurable, _ := GetBool("configurable", node)
	return configurable
}
var FilterShared FilterFunction = func(node *ajson.Node) bool {
	configurable, _ := GetBool("shared", node)
	return configurable
}

type Processor added in v0.1.78

type Processor interface {
	Process(s *jsonschema.Schema)
}

Jump to

Keyboard shortcuts

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