Skip to main content

Module validation

Module validation 

Source

Constants§

ENTITY_COMPONENT_TABLES
List of 1:1 component table names that should be cascade-deleted when an entity is removed.
MAX_ID_LEN
Maximum length for entity/topology ID strings.
MAX_INFERENCE_CONTENT_LEN
Maximum length for inference message content.
MAX_JSON_LEN
Maximum length for JSON payload fields.
MAX_NOTES_LEN
Maximum length for notes/description fields.
MAX_STRING_LEN
Maximum length for general string fields.

Functions§

sanitize_inference_input
Sanitize inference input: reject if over max length, strip control chars.
validate_entity_id
Validate an entity ID string: non-empty, max 128 chars, alphanumeric + underscore + hyphen.
validate_non_empty
Validate a string field is non-empty.
validate_range_i32
Validate an i32 value is within an inclusive range.
validate_range_i64
Validate a numeric value is within an inclusive range.
validate_range_u64
Validate a u64 value is within an inclusive range.
validate_scope_key
Validate a scope key string.
validate_string_len
Validate a string field does not exceed the given max length.
validate_topology_chain
Validate topology hierarchy: verify that area belongs to region and region belongs to world. Returns Ok if all IDs are valid format. Actual DB lookups must be done in the reducer.
validate_topology_id
Validate a topology ID string (area_id, region_id, world_id): same rules as entity ID.