jsonschema

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaURL2020 = "https://json-schema.org/draft/2020-12/schema"
	SchemaURL2019 = "https://json-schema.org/draft/2019-09/schema"
	SchemaURL07   = "http://json-schema.org/draft-07/schema#"
)

Variables

This section is empty.

Functions

func CompileSchema

func CompileSchema(root *yaml.Node) (*santhoshjsonschema.Schema, error)

func EnsureRootSchema

func EnsureRootSchema(root *yaml.Node, schemaURL string)

func FindNodeByLocation

func FindNodeByLocation(root *yaml.Node, location []string) (*yaml.Node, string)

func HasSchemaKeyword

func HasSchemaKeyword(root *yaml.Node) bool

func InstanceLocationPointer

func InstanceLocationPointer(location []string) string

func IsDelegatingRefRoot

func IsDelegatingRefRoot(root *yaml.Node) bool

func IsDynamicScopeIndexingError

func IsDynamicScopeIndexingError(err *index.IndexingError) bool

IsDynamicScopeIndexingError reports whether a libopenapi indexing error came from a dynamic-scope reference keyword.

func IsDynamicScopeResolvingError

func IsDynamicScopeResolvingError(err *index.ResolvingError) bool

IsDynamicScopeResolvingError reports whether a libopenapi resolving error came from a dynamic-scope reference keyword.

func IsFragmentRoot

func IsFragmentRoot(root *yaml.Node) bool

func IsSupportedDialect

func IsSupportedDialect(format string) bool

func MappingValueNode

func MappingValueNode(node *yaml.Node, key string) *yaml.Node

func NewDoctorDocumentFromRolodexIndex

func NewDoctorDocumentFromRolodexIndex(idx *index.SpecIndex, config RolodexDoctorBuildConfig) (*doctorModel.DrDocument, error)

NewDoctorDocumentFromRolodexIndex builds a Doctor document from a libopenapi rolodex root index.

JSON Schema references are foundationally owned by libopenapi's index and rolodex. This builder does not resolve, discover, or reinterpret references; it only turns the already-indexed schema root into Doctor models while Doctor walks the schema graph.

func NewReferenceValidationRule

func NewReferenceValidationRule() *model.Rule

NewReferenceValidationRule builds the synthetic JSON Schema reference validation rule used by the motor.

func NodeToInterface

func NodeToInterface(node *yaml.Node) (any, error)

func RootNode

func RootNode(node *yaml.Node) *yaml.Node

func ToJSON

func ToJSON(root *yaml.Node, pretty bool) ([]byte, error)

Types

type Dialect

type Dialect struct {
	Format string
	URL    string
	Draft  *santhoshjsonschema.Draft
}

func DetectDialect

func DetectDialect(root *yaml.Node) Dialect

type RolodexDoctorBuildConfig

type RolodexDoctorBuildConfig struct {
	BuildGraph         bool
	DeterministicPaths bool
	Logger             *slog.Logger
	RenderChanges      bool
	StorageRoot        string
	UseSchemaCache     bool
}

RolodexDoctorBuildConfig configures schema-only Doctor document construction from a libopenapi rolodex index.

type ValidationIssue

type ValidationIssue struct {
	Message  string
	Pointer  string
	Path     string
	Node     *yaml.Node
	EndNode  *yaml.Node
	Location []string
}

func ValidateAgainstMetaschema

func ValidateAgainstMetaschema(root *yaml.Node) ([]ValidationIssue, error)

Jump to

Keyboard shortcuts

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