Skip to content

Validation and "fixup"

Quadrollopo edited this page Oct 5, 2020 · 3 revisions

All items go through a two-step validation process, that takes into account their features and their location:

  • Fixup: try to move misplaced items to their correct location
  • Validation: check that no impossible placements are still there, accept or reject the entire request accordingly

For instance, fixup moves RAM modules from a case to the motherboard contained inside it. If the motherboard could not be found or the fixup could not be applied, the request still goes through to the next phase.

Validation checks that RAM and motherboards have the same socket, and does the same for CPUs and motherboards, and prevents impossible placements like a CPU inside a HDD, and the like. If any validation step fails, the entire request is rejected.

This is done both for newly added items, and for "move" operations, even moves that restore deleted items.
The src/ItemLocationValidator.php file contains the code that does all these checks.

Both validation and fixup can be disabled on a per-request basis, with a parameter which will not be named since you shouldn't use it: if you really (and desperately) need it, check APIv2/Controller.php.

Clone this wiki locally