metavalidator

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package metavalidator provides attribute validators that combine (algebraically) other attribute validators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(valueValidators ...tfsdk.AttributeValidator) tfsdk.AttributeValidator

All returns an AttributeValidator which ensures that any configured attribute value:

  • Validates against all the value validators.

Use of All is only necessary when used in conjunction with Any or AnyWithAllWarnings as the []tfsdk.AttributeValidator field automatically applies a logical AND.

func Any

func Any(valueValidators ...tfsdk.AttributeValidator) tfsdk.AttributeValidator

Any returns an AttributeValidator which ensures that any configured attribute value:

  • Validates against at least one of the value validators.

To prevent practitioner confusion should non-passing validators have conflicting logic, only warnings from the passing validator are returned. Use AnyWithAllWarnings() to return warnings from non-passing validators as well.

func AnyWithAllWarnings

func AnyWithAllWarnings(valueValidators ...tfsdk.AttributeValidator) tfsdk.AttributeValidator

AnyWithAllWarnings returns an AttributeValidator which ensures that any configured attribute value:

  • Validates against at least one of the value validators.
  • Returns all warnings for all passing and failing validators when at least one of the validators passes.

Use Any() to only return warnings from the passing validator.

Types

This section is empty.

Jump to

Keyboard shortcuts

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