validator

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 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"`
	Expected         interface{} //Deprecated
	Source           interface{} //optional validation source
	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) Init added in v0.26.0

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 added in v0.24.0

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