validators

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 7 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceSchema

type ResourceSchema struct {
	Schema   *openapi3.SchemaRef
	TypeName string
}

ResourceSchema represents a validation schema for a specific resource type

type SchemaValidator

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

SchemaValidator validates JSON objects against OpenAPI schemas

func NewSchemaValidator

func NewSchemaValidator(schemaPath string) (*SchemaValidator, error)

NewSchemaValidator creates a new schema validator by loading an OpenAPI spec from the given path. Panics if any registered entity with RequireSpecSchema has a SpecSchemaName that does not resolve. Entities without RequireSpecSchema whose schema is absent are skipped with a warning.

func (*SchemaValidator) HasSchema added in v0.3.1

func (v *SchemaValidator) HasSchema(resourcePlural string) bool

HasSchema reports whether a validation schema was loaded for the given resource plural.

func (*SchemaValidator) Validate

func (v *SchemaValidator) Validate(resourcePlural string, spec map[string]interface{}) error

Validate validates a spec for the given resource plural (URL path segment). Returns nil when no schema is loaded for the plural (validation skipped).

Jump to

Keyboard shortcuts

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