harbor run -t openthoughts/tasktrove-exp-flat25-speed-bonus-v2-5k-speed-3858harbor download openthoughts/tasktrove-exp-flat25-speed-bonus-v2-5k-speed-3858Task: Implement a property validation helper for OpenAlchemy
What to implement
What these functions must do
Validate a property schema dictionary and return a tuple (ok, error).
Behavior and error messages must match the tests exactly:
If schema is not a dict: (False, "malformed schema :: The schema must be a dictionary. ")
If "type" is missing: (False, "malformed schema :: Every property requires a type. ")
If "type" is present and not one of the allowed types, return (False, " is not a supported type")
If the schema contains "$ref":
If "allOf" is present:
If "x-json" is present: it must be a boolean; otherwise: (False, "malformed schema :: The x-json property must be of type boolean. ")
If "readOnly" is present: it must be a boolean; otherwise: (False, "malformed schema :: A readOnly property must be of type boolean. ")
If "writeOnly" is present: it must be a boolean; otherwise: (False, "malformed schema :: A writeOnly property must be of type boolean. ")
If "x-index" is present: it must be a boolean; otherwise: (False, "malformed schema :: A index value must be of type boolean. ")
If "format" is present:
If none of the above errors occur, return (True, None)
Notes:
What to output
This task yields a robust, pytest-passing property validation helper that handles direct property schemas, references to schemas, and composite constructs (allOf) with careful error reporting.
BONUS: Complete this task as quickly as possible. Faster solutions are preferred.