Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Gob = Codec{ MarshalFn: func(value any, writer io.Writer) error { return gob.NewEncoder(writer).Encode(value) }, UnmarshalFn: func(reader io.Reader, value any) error { return gob.NewDecoder(reader).Decode(value) }, }
View Source
var JSON = Codec{ MarshalFn: func(value any, writer io.Writer) error { encoder := json.NewEncoder(writer) encoder.SetIndent("", " ") return encoder.Encode(value) }, UnmarshalFn: func(reader io.Reader, value any) error { return json.NewDecoder(reader).Decode(value) }, }
View Source
var YAML = Codec{ MarshalFn: func(value any, writer io.Writer) error { encoder := yaml.NewEncoder(writer) encoder.SetIndent(2) return encoder.Encode(value) }, UnmarshalFn: func(reader io.Reader, value any) error { return yaml.NewDecoder(reader).Decode(value) }, }
Functions ¶
func CloseQuietly ¶
func CloseQuietly(value any)
func SpecifyType ¶
Types ¶
type Codec ¶
type DefaultSourceProvider ¶
func (*DefaultSourceProvider) GetSources ¶
func (p *DefaultSourceProvider) GetSources(ctx context.Context) ([]Source, error)
type InputSource ¶
type PropertySource ¶
type PropertySource []Property
type Schema ¶
type Schema struct {
Type string `yaml:"type"`
Items *Schema `yaml:"items,omitempty"`
Properties map[string]Schema `yaml:"properties,omitempty"`
AdditionalProperties any `yaml:"additionalProperties,omitempty"`
Required []string `yaml:"required,omitempty"`
// properties below are applied to primitive or inner types
Enum any `yaml:"enum,omitempty" prop:"inner,array"`
Examples any `yaml:"examples,omitempty" prop:"inner,array"`
Pattern string `yaml:"pattern,omitempty" prop:"inner"`
Format string `yaml:"format,omitempty" prop:"inner" alias:"fmt"`
Minimum any `yaml:"minimum,omitempty" prop:"inner" alias:"min"`
ExclusiveMinimum any `yaml:"exclusiveMinimum,omitempty" prop:"inner" alias:"xmin"`
Maximum any `yaml:"maximum,omitempty" prop:"inner" alias:"max"`
ExclusiveMaximum any `yaml:"exclusiveMaximum,omitempty" prop:"inner" alias:"xmax"`
MultipleOf any `yaml:"multipleOf,omitempty" prop:"inner" alias:"mul"`
MinLength uint64 `yaml:"minLength,omitempty" prop:"inner" alias:"minlen"`
MaxLength *uint64 `yaml:"maxLength,omitempty" prop:"inner" alias:"maxlen"`
// properties below are applied to primitive or outer types
Description string `yaml:"description,omitempty" prop:"outer" alias:"desc,doc"`
Default any `yaml:"default,omitempty" prop:"outer" alias:"def"`
MinItems uint64 `yaml:"minItems,omitempty" prop:"outer" alias:"minsize"`
MaxItems *uint64 `yaml:"maxItems,omitempty" prop:"outer" alias:"maxsize"`
UniqueItems bool `yaml:"uniqueItems,omitempty" prop:"outer" alias:"unique"`
MinProperties uint64 `yaml:"minProperties,omitempty" prop:"outer" alias:"minprops"`
MaxProperties *uint64 `yaml:"maxProperties,omitempty" prop:"outer" alias:"maxprops"`
}
func FromProvider ¶
func GenerateSchema ¶
func (*Schema) ApplyDefaults ¶
Click to show internal directories.
Click to hide internal directories.