Overview
TheValidationResponse DTO contains the results of validating a player’s answer to a crafting question. It provides detailed feedback including correctness, the right answer, and scoring information.
Fields
Indicates whether the player’s answer was correct.
true if the selected components exactly match the required components, false otherwise.List of item IDs representing the correct components needed to craft the target item. This is always provided regardless of whether the answer was correct.
List of display names for the correct components (e.g., [“Phage”, “Hearthbound Axe”, “Sheen”]). Useful for displaying feedback to the player.
List of ItemOption objects with complete details about each correct component. Each ItemOption contains:
itemId (String), name (String), imageUrl (String), and cost (Integer).List of item IDs that the player selected incorrectly. This will be an empty list if the answer was correct. Helps players understand which selections were wrong.
Human-readable feedback message describing the result. Examples:
- “Correct! You’ve successfully crafted Trinity Force.”
- “Incorrect. The correct components are: Phage, Hearthbound Axe, Sheen.”
Points awarded for this answer. Typically a positive value (e.g., 100) for correct answers and 0 for incorrect answers. May vary based on difficulty or time taken.
Example JSON (Correct Answer)
Example JSON (Incorrect Answer)
Usage
This model is returned by the POST /api/game/validate endpoint after the player submits their answer. The frontend should use this response to:- Display whether the answer was correct or incorrect
- Show the correct components if the player was wrong
- Highlight which components the player selected incorrectly
- Update the player’s score with the awarded points
- Display the feedback message
Validation Logic
- An answer is considered correct only if
selectedComponentIdsexactly matchescorrectComponentIds(same items, order doesn’t matter) - Partial credit is not awarded - the player must select all correct components and no incorrect ones
- The
incorrectComponentIdsfield helps identify which selections were wrong by comparing the selected components with the correct ones