validators

package
v0.4.20 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExactlyOneChild

func ExactlyOneChild() validator.Object

ExactlyOneChild returns an AttributeValidator which ensures that any configured attribute object has only one child attribute. Null (unconfigured) and unknown values are skipped.

func IsRFC3339

func IsRFC3339() validator.String

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

  • Is a String.
  • Is in RFC3339 Format.

Null (unconfigured) and unknown (known after apply) values are skipped.

func IsValidDate

func IsValidDate() validator.String

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

  • Is a String.
  • Is in YYYY-MM-DD Format.

Null (unconfigured) and unknown (known after apply) values are skipped.

func IsValidJSON

func IsValidJSON() validator.String

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

  • Is a String.
  • Is considered valid JSON.

Null (unconfigured) and unknown (known after apply) values are skipped.

Types

type DateValidator

type DateValidator struct {
}

func (DateValidator) Description

func (validator DateValidator) Description(ctx context.Context) string

func (DateValidator) MarkdownDescription

func (validator DateValidator) MarkdownDescription(ctx context.Context) string

func (DateValidator) ValidateString

func (validator DateValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)

type JSONParseValidator

type JSONParseValidator struct {
}

JSONParseValidator validates if the provided value is of type string and can be parsed as JSON.

func (JSONParseValidator) Description

func (validator JSONParseValidator) Description(ctx context.Context) string

func (JSONParseValidator) MarkdownDescription

func (validator JSONParseValidator) MarkdownDescription(ctx context.Context) string

func (JSONParseValidator) ValidateString

func (validator JSONParseValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)

type RFC3339TimeValidator

type RFC3339TimeValidator struct {
}

func (RFC3339TimeValidator) Description

func (validator RFC3339TimeValidator) Description(ctx context.Context) string

func (RFC3339TimeValidator) MarkdownDescription

func (validator RFC3339TimeValidator) MarkdownDescription(ctx context.Context) string

func (RFC3339TimeValidator) ValidateString

func (validator RFC3339TimeValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)

Jump to

Keyboard shortcuts

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