json

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package json provides JSON validator for the Cloudprober's validator framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

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

Validator implements a regex validator.

func (*Validator) Init

func (v *Validator) Init(config interface{}, l *logger.Logger) error

Init initializes the JSON validator. It parses the jq filter in the configuration and returns an error if it doesn't parse for some reason.

func (*Validator) Validate

func (v *Validator) Validate(responseBody []byte) (bool, error)

Validate the provided responseBody. If no jq filter is configured, it returns true if responseBody is a valid JSON. If jq filter is configured, validator returns true if jq filter returns true.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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