", "description": "", "acceptance_criteria": ["Custom error messages from the original implementation are preserved", "", "", ""], "learning_materials": [{ "url": "https://" }] }, { "introduction": "", "title": "", "description": "", "acceptance_criteria": ["", "", "", ""], "learning_materials": [{ "url": "" }] } ] } ] } } "> ", "description": "", "acceptance_criteria": ["Custom error messages from the original implementation are preserved", "", "", ""], "learning_materials": [{ "url": "https://" }] }, { "introduction": "", "title": "", "description": "", "acceptance_criteria": ["", "", "", ""], "learning_materials": [{ "url": "" }] } ] } ] } } "> ", "description": "", "acceptance_criteria": ["Custom error messages from the original implementation are preserved", "", "", ""], "learning_materials": [{ "url": "https://" }] }, { "introduction": "", "title": "", "description": "", "acceptance_criteria": ["", "", "", ""], "learning_materials": [{ "url": "" }] } ] } ] } } ">
{
"project": {
"title": "Fix Bugs 20x Faster - From Zero to Incident Superhero Workshop",
"description": "",
"sprints": [
{
"title": "Tasks",
"tasks": [
{
"introduction": "",
"title": "<Max 70 characters>",
"description": "",
"acceptance_criteria": ["Custom error messages from the original implementation are preserved", "", "", ""],
"learning_materials": [{ "url": "https://" }]
},
{
"introduction": "",
"title": "",
"description": "",
"acceptance_criteria": ["", "", "", ""],
"learning_materials": [{ "url": "" }]
}
]
}
]
}
}
Example description (can use md formatting):
In your cloned project, navigate to the `task_2` folder and inspect the existing validation logic in the UserProfile class. Currently, validations are handled manually through numerous conditional statements, making the code cumbersome and challenging to maintain. An accompanying RSpec test file has been provided to ensure your refactoring preserves existing behavior.
Refactor the validation logic in UserProfile using Dry::Validation. Transition from manual conditionals to a clear, declarative schema. The goal is to simplify the code, enhance readability, and facilitate future changes.
What is Dry::Validation?
Dry::Validation is a powerful validation library within the dry-rb ecosystem. Unlike Dry::Schema, which defines basic type and structure constraints, Dry::Validation adds advanced, rule-based validations and complex conditional logic. This makes it particularly useful for expressing intricate validation requirements clearly and succinctly, resulting in maintainable, expressive, and robust validation code.
When is Dry::Schema a good choice?
Dry::Schema is ideal when your validation requirements are straightforward and primarily concerned with data types, structure, and presence checks. It's lightweight and perfect for simple scenarios where advanced, rule-based logic isn't required.
Please do the following (ideally before the workshop)