validator: annotate MapCheck fields

This commit is contained in:
Quaternions 2025-04-11 20:19:49 -07:00
parent 34d1db02a5
commit 6efab4f411
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131

@ -260,16 +260,33 @@ pub struct MapInfoOwned{
// crazy!
pub struct MapCheck<'a>{
// === METADATA CHECKS ===
// The root must be of class Model
model_class:StringCheck<'a,(),&'a str>,
// Model's name must be in snake case
model_name:StringCheck<'a,(),String>,
// Map must have a StringValue named DisplayName.
// Value must not be empty, must be in title case.
display_name:Result<StringEmptyCheck<StringCheck<'a,&'a str,String>>,StringValueError>,
// Map must have a StringValue named Creator.
// Value must not be empty.
creator:Result<StringEmptyCheck<&'a str>,StringValueError>,
// The prefix of the model's name must match the game it was submitted for.
// bhop_ for bhop, and surf_ for surf
game_id:Result<GameID,ParseGameIDError>,
// === MODE CHECKS ===
// MapStart must exist
mapstart:Result<(),()>,
// No duplicate map starts (including bonuses)
mode_start_counts:DuplicateCheck<ModeID>,
// At least one finish zone for each start zone, and no finishes with no start
mode_finish_counts:AtLeastOneMatchingAndNoExtraCheck<ModeID>,
// Spawn1 must exist
spawn1:Result<(),()>,
// No duplicate Spawn#
spawn_counts:DuplicateCheck<SpawnID>,
// No duplicate WormholeOut# (duplicate WormholeIn# ok)
wormhole_out_counts:DuplicateCheck<WormholeOutID>,
}