From 8dac1792a098e35f5bed524079292b7bab5becdf Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sat, 4 May 2024 12:34:13 +0200 Subject: [PATCH] Add online documentation for CoreValidationSingle --- docs/docs/reference/coretypes.md | 2 + docs/docs/reference/validationsingle.md | 68 +++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 docs/docs/reference/validationsingle.md diff --git a/docs/docs/reference/coretypes.md b/docs/docs/reference/coretypes.md index 1f5343e..87942dc 100644 --- a/docs/docs/reference/coretypes.md +++ b/docs/docs/reference/coretypes.md @@ -16,3 +16,5 @@ Available log levels, followingthe StarOpenSource Logging Specification (SOSLS) Available scene types. ### BlockadeLevel{ IGNORE, WARN, BLOCK } To what degree *something* should be blocked. +### ValidationType{ MATCHES_TYPE, MATCHES_CLASS, IN_RANGE, HAS_MINIMUM, HAS_MAXIMUM, HAS_VALUES, CONTAINS, MATCHES_REGEX, IS_NOT_EMPTY, IS_NOT_NULL, IS_NORMALIZED, IS_ORTHONORMALIZED } +All validation rules some data can be checked against. diff --git a/docs/docs/reference/validationsingle.md b/docs/docs/reference/validationsingle.md new file mode 100644 index 0000000..1356a62 --- /dev/null +++ b/docs/docs/reference/validationsingle.md @@ -0,0 +1,68 @@ +--- +sidebar_position: 10 +description: Used for validating data. +--- + +# `CoreValidationSingle` +Provides the default configuration for the CORE Framework. + + +## Variables +### *Array[Dictionary]* rules = *[]* +:::danger[Don't modify] +Do not modify this. +::: +All rules to evaluate in `evaluate()`. +### *Array[String]* failures = *[]* +:::danger[Don't modify] +Do not modify this. +::: +Contains error messages for failed rules. + +## Functions +### *bool* evaluate() +Evaluates all set rules and returns `true` if all rules passed, or `false` if at least one failed. +### *CoreValidationSingle* matches_type(*Array[Variant.Type]* types) +Validates if `data` matches some data type. \ +Applies to all data types (obviously). +### *CoreValidationSingle* matches_class(*StringName* class, *bool* exact) +Validates if `data` matches some class. \ +Applies to **Object**. +### *CoreValidationSingle* in_range_int(*int* from, *int* to) +Validates if `data` contains the specified integer range. \ +Applies to **int**. +### *CoreValidationSingle* in_range_float(*float* from, *float* to) +Validates if `data` contains the specified float range. \ +Applies to **float**. +### *CoreValidationSingle* has_minimum_int(*int* minimum) +Ensures that `data` is equal to or exceeds the specified integer. \ +Applies to **int**. +### *CoreValidationSingle* has_maximum_int(*int* maximum) +Ensures that `data` is under the specified integer. \ +Applies to **int**. +### *CoreValidationSingle* has_minimum_float(*float* minimum) +Ensures that `data` is equal to or exceeds the specified float. \ +Applies to **float**. +### *CoreValidationSingle* has_maximum_float(*float* maximum) +Ensures that `data` is under the specified float. \ +Applies to **float**. +### *CoreValidationSingle* has_values(*Array* values) +Checks whenether at least one value matches `data`. +Applies to all data types. +### *CoreValidationSingle* contains(*Array[String]* values, *int* minimum_matches = *1*) +Ensures that [param data] contains at least <`minimum_matches`> values. \ +Applies to **String** & **StringName**. +### *CoreValidationSingle* matches_regex(*String* regex_string) +Matches a regular expression against `data`. \ +Applies to **String** & **StringName**. +### *CoreValidationSingle* is_not_empty() +Ensures that `data` is not empty. \ +Applies to **String** & **StringName** (`!= ""`), **int** (`!= 0`) and **float** (`!= 0.0`). +### *CoreValidationSingle* is_not_null() +Ensures that `data` is not `null`. +### *CoreValidationSingle* is_normalized() +Ensures that `data` is normalized. \ +Applies to **Vector2**, **Vector3**, **Vector4**, **Plane** and **Quaternion**. +### *CoreValidationSingle* is_orthonormalized() +Ensures that `data` is orthonormalized. \ +Applies to **Transform2D**, **Transform3D** and **Basis**.