Validator¶
Namespace Nfty.Core.Formats in assembly Nfty.Core.
The single place that decides what a legal CookBook is.
It REPORTS problems and never throws, because validate — and a GUI asking "what is wrong with this book?" — exists precisely to explain a broken one. A validator that crashes on bad input fails at the only moment it matters.
Methods¶
Validate(LoadedCookBook)¶
Checks a book and returns every problem found, rather than stopping at the first.
Parameters
cb(LoadedCookBook) - The book to check.
Returns. One human-readable line per problem; empty when the book is legal.
ValidateIngredient(LoadedIngredient)¶
Validates a standalone ingredient — every check that does NOT need a canvas. The canvas is a property of the CookBook, so "does this variant match the canvas?" cannot be answered here; Validator.Validate() remains the authoritative whole-book gate. Used by the CLI's new ingredient / add variant, which build an .igt before a canvas exists.
Parameters
ing(LoadedIngredient) - The ingredient to check.
Returns. One sentence per problem; empty when the ingredient is valid. Never throws for a bad ingredient.
ValidateRecipe(LoadedRecipe)¶
Validates a standalone recipe — every canvas-independent check, plus that all variant images across all its ingredients share one size, so they could match some future canvas. Used by the CLI's new recipe / add ingredient.
Parameters
r(LoadedRecipe) - The recipe to check.
Returns. One sentence per problem; empty when the recipe is valid. Never throws for a bad recipe.