Implement a tiny schema validator (like a subset of JSON Schema or Pydantic). A schema is:
{"type": "string" | "integer" | "number" | "boolean"} — integer excludes booleans; number
accepts ints and floats (not booleans){"type": "array", "items": <schema>}{"type": "object", "properties": {name: <schema>}, "required": [names]} — extra properties are allowedReturn the sorted list of error paths with messages, as strings like "$.user.age: expected integer" or
"$.tags[1]: expected string" or "$.user.name: required". Report a type error at the node and don't
descend further into it.
Implement validate. Input: data: any, schema: dict. Returns: list[str].
def validate(data, schema: dict) -> list[str]:
return []
Run executes the public tests. Submit grades against public and hidden tests.
Implement a tiny schema validator (like a subset of JSON Schema or Pydantic). A schema is:
{"type": "string" | "integer" | "number" | "boolean"} — integer excludes booleans; number
accepts ints and floats (not booleans){"type": "array", "items": <schema>}{"type": "object", "properties": {name: <schema>}, "required": [names]} — extra properties are allowedReturn the sorted list of error paths with messages, as strings like "$.user.age: expected integer" or
"$.tags[1]: expected string" or "$.user.name: required". Report a type error at the node and don't
descend further into it.
Implement validate. Input: data: any, schema: dict. Returns: list[str].
def validate(data, schema: dict) -> list[str]:
return []
Run executes the public tests. Submit grades against public and hidden tests.