Help us shape the future of Go! Take the 2026 Go Developer Survey

validator

package
v0.77.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Validator Service

Service Id Action Description Request Response
validator assert perform validation on provided actual vs expected data structure. AssertRequest AssertionInfo

Documentation

Index

Constants

View Source
const AssertAction = "assert"

AssertAction represents assert action

View Source
const ServiceID = "validator"

ServiceID represents validator service id

Variables

This section is empty.

Functions

func New

func New() endly.Service

New creates a new validation service

Types

type AssertRequest

type AssertRequest struct {
	TagID            string
	Name             string
	Description      string
	Actual           interface{} `required:"true" description:"actual value/data structure"`
	Expect           interface{} `required:"true" description:"expected value/data structure"`
	Source           interface{} //optional validation source
	Ignore           interface{}
	OmitEmpty        bool
	NormalizeKVPairs bool //flag to normalize kv pairs into map if possible (i.e, when using yaml)
}

AssertRequest represent assert request

func NewAssertRequest

func NewAssertRequest(tagID string, name string, description string, source, expected, actual interface{}) *AssertRequest

NewAssertRequest creates a new assertRequest

func NewAssertRequestFromContext

func NewAssertRequestFromContext(context *endly.Context, source, expected, actual interface{}, name, description string) (*AssertRequest, error)

NewAssertRequestFromContext creates a new assert rquest from context for current activity

func (*AssertRequest) IgnoreKeys

func (r *AssertRequest) IgnoreKeys() []interface{}

func (*AssertRequest) Init

func (r *AssertRequest) Init() error

type AssertResponse

type AssertResponse struct {
	*assertly.Validation
}

AssertResponse represent validation response

func Assert

func Assert(context *endly.Context, source, expected, actual interface{}, name, description string) (*AssertResponse, error)

Assert compares provided expected amd actual

func (*AssertResponse) Assertion

func (r *AssertResponse) Assertion() []*assertly.Validation

Assertion returns validation slice

type TaggedAssert

type TaggedAssert struct {
	TagID    string
	Expected interface{}
	Actual   interface{}
}

TaggedAssert represents tagged with ID assert

Jump to

Keyboard shortcuts

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