Add online documentation for CoreValidationSingle

This commit is contained in:
JeremyStar™ 2024-05-04 12:34:13 +02:00
parent 35868ca52d
commit 8dac1792a0
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 70 additions and 0 deletions

View file

@ -16,3 +16,5 @@ Available log levels, followingthe StarOpenSource Logging Specification (SOSLS)
Available scene types. Available scene types.
### <u>BlockadeLevel</u>{ IGNORE, WARN, BLOCK } ### <u>BlockadeLevel</u>{ IGNORE, WARN, BLOCK }
To what degree *something* should be blocked. To what degree *something* should be blocked.
### <u>ValidationType</u>{ 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.

View file

@ -0,0 +1,68 @@
---
sidebar_position: 10
description: Used for validating data.
---
# `CoreValidationSingle`
Provides the default configuration for the CORE Framework.
## Variables
### *Array[Dictionary]* <u>rules</u> = *[]*
:::danger[Don't modify]
Do not modify this.
:::
All rules to evaluate in `evaluate()`.
### *Array[String]* <u>failures</u> = *[]*
:::danger[Don't modify]
Do not modify this.
:::
Contains error messages for failed rules.
## Functions
### *bool* <u>evaluate</u>()
Evaluates all set rules and returns `true` if all rules passed, or `false` if at least one failed.
### *CoreValidationSingle* <u>matches_type</u>(*Array[Variant.Type]* <u>types</u>)
Validates if `data` matches some data type. \
Applies to all data types (obviously).
### *CoreValidationSingle* <u>matches_class</u>(*StringName* <u>class</u>, *bool* <u>exact</u>)
Validates if `data` matches some class. \
Applies to **Object**.
### *CoreValidationSingle* <u>in_range_int</u>(*int* <u>from</u>, *int* <u>to</u>)
Validates if `data` contains the specified integer range. \
Applies to **int**.
### *CoreValidationSingle* <u>in_range_float</u>(*float* <u>from</u>, *float* <u>to</u>)
Validates if `data` contains the specified float range. \
Applies to **float**.
### *CoreValidationSingle* <u>has_minimum_int</u>(*int* <u>minimum</u>)
Ensures that `data` is equal to or exceeds the specified integer. \
Applies to **int**.
### *CoreValidationSingle* <u>has_maximum_int</u>(*int* <u>maximum</u>)
Ensures that `data` is under the specified integer. \
Applies to **int**.
### *CoreValidationSingle* <u>has_minimum_float</u>(*float* <u>minimum</u>)
Ensures that `data` is equal to or exceeds the specified float. \
Applies to **float**.
### *CoreValidationSingle* <u>has_maximum_float</u>(*float* <u>maximum</u>)
Ensures that `data` is under the specified float. \
Applies to **float**.
### *CoreValidationSingle* <u>has_values</u>(*Array* <u>values</u>)
Checks whenether at least one value matches `data`.
Applies to all data types.
### *CoreValidationSingle* <u>contains</u>(*Array[String]* <u>values</u>, *int* <u>minimum_matches</u> = *1*)
Ensures that [param data] contains at least <`minimum_matches`> values. \
Applies to **String** & **StringName**.
### *CoreValidationSingle* <u>matches_regex</u>(*String* <u>regex_string</u>)
Matches a regular expression against `data`. \
Applies to **String** & **StringName**.
### *CoreValidationSingle* <u>is_not_empty</u>()
Ensures that `data` is not empty. \
Applies to **String** & **StringName** (`!= ""`), **int** (`!= 0`) and **float** (`!= 0.0`).
### *CoreValidationSingle* <u>is_not_null</u>()
Ensures that `data` is not `null`.
### *CoreValidationSingle* <u>is_normalized</u>()
Ensures that `data` is normalized. \
Applies to **Vector2**, **Vector3**, **Vector4**, **Plane** and **Quaternion**.
### *CoreValidationSingle* <u>is_orthonormalized</u>()
Ensures that `data` is orthonormalized. \
Applies to **Transform2D**, **Transform3D** and **Basis**.