configschema

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StringLikeRef          = "#/$defs/" + stringLikeId
	StringLikeWithBlankRef = "#/$defs/" + stringLikeWithBlankId
)
View Source
var (
	StringLike = &jsonschema.Schema{
		Description: "Any value that can be cast to a string of at least one character long",
		OneOf: []*jsonschema.Schema{
			{
				Type:      "string",
				MinLength: 1,
			},
			{
				Extras: map[string]interface{}{
					"type": []string{"number", "boolean"},
				},
			},
		},
	}

	StringLikeWithBlank = &jsonschema.Schema{

		Extras: map[string]interface{}{
			"type": []string{"number", "string", "boolean"},
		},
		Description: "Any value that can be cast to a string, or blank",
	}
)

Functions

func GenerateSchema

func GenerateSchema(v interface{}) *jsonschema.Schema

func GetSchemaProp

func GetSchemaProp(base *jsonschema.Schema, propName string) *jsonschema.Schema

Extract a property from a schema without having to cast it NOTE: This assumes you know the prop exists. There is no error checking

func SchemaNamer

func SchemaNamer(t reflect.Type) string

func SchemaPropMerge

func SchemaPropMerge(base *jsonschema.Schema, propName string, modifyFunc func(*jsonschema.Schema))

Types

type PropertyChain

type PropertyChain struct {
	// contains filtered or unexported fields
}

func NewPropertyChain

func NewPropertyChain() *PropertyChain

func (*PropertyChain) End

func (obj *PropertyChain) End() *orderedmap.OrderedMap

func (*PropertyChain) Set

func (obj *PropertyChain) Set(key string, value interface{}) *PropertyChain

Jump to

Keyboard shortcuts

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