validators

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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