validator

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package validator provides validation for known data formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct{}

Service provides format validation for known data formats.

func NewService

func NewService() *Service

NewService creates a new validation service.

func (*Service) IsValidFormat added in v0.9.1

func (s *Service) IsValidFormat(format string) bool

IsValidFormat checks if format is in the list of supported formats.

func (*Service) SupportedFormats added in v0.9.1

func (s *Service) SupportedFormats() []string

SupportedFormats returns the list of supported formats.

func (*Service) Validate

func (s *Service) Validate(format string, value []byte) error

Validate checks if value is valid for the given format. Returns nil for text, shell, or unknown formats (no validation). Returns descriptive error for invalid json, yaml, xml, toml, ini, hcl. Note: YAML is extremely permissive - almost any text parses as a valid string scalar.

Jump to

Keyboard shortcuts

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