Add tests for .json_schema and raise errors

We now have tests for the `json_schema` class method. And while we’re at it, let’s make it raise errors too.