validators

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func IsValidIdentifier

IsValidIdentifier is a validator that can be used for validating identifiers passed in resources and data sources.

Typically, we expect passed identifiers to be a variation of sdk.ObjectIdentifier. For now, we're expecting implementations of sdk.ObjectIdentifier, because we won't support sdk.ExternalObjectIdentifiers. The reason behind it is that the functions that parse identifiers are not able to differentiate between sdk.ExternalObjectIdentifiers and sdk.DatabaseObjectIdentifier or sdk.SchemaObjectIdentifier. That's because sdk.ExternalObjectIdentifiers has varying parts count (2 or 3).

To use this function, pass it as a validation function on identifier field with generic parameter set to the desired sdk.ObjectIdentifier implementation.

func NormalizeValidation

func NormalizeValidation[T any](normalize func(string) (T, error)) schema.SchemaValidateDiagFunc

func StringInSlice

func StringInSlice(valid []string, ignoreCase bool) schema.SchemaValidateDiagFunc

StringInSlice has the same implementation as validation.StringInSlice, but adapted to schema.SchemaValidateDiagFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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