schema

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package schema defines a deliberately bounded schema vocabulary for plugin payloads and configuration. It is not a complete JSON Schema implementation.

Index

Constants

View Source
const Version = "ext.schema/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

type Schema struct {
	Type                 string            `json:"type"`
	Properties           map[string]Schema `json:"properties,omitempty"`
	Required             []string          `json:"required,omitempty"`
	AdditionalProperties bool              `json:"additionalProperties,omitempty"`
	Items                *Schema           `json:"items,omitempty"`
	Enum                 []string          `json:"enum,omitempty"`
	Minimum              *float64          `json:"minimum,omitempty"`
	Maximum              *float64          `json:"maximum,omitempty"`
	MinLength            int               `json:"minLength,omitempty"`
	MaxLength            int               `json:"maxLength,omitempty"`
	MinItems             int               `json:"minItems,omitempty"`
	MaxItems             int               `json:"maxItems,omitempty"`
}

Schema rejects undeclared object properties by default. Types are object, array, string, number, integer, boolean and null. Constraints inappropriate for a type are rejected. Optional fields may be absent; null is a distinct type.

func (Schema) Check

func (s Schema) Check(data json.RawMessage) error

Check validates JSON without including payload values in errors.

func (Schema) Clone

func (s Schema) Clone() Schema

Clone detaches caller-owned maps and slices after validation.

func (Schema) Validate

func (s Schema) Validate() error

Jump to

Keyboard shortcuts

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