And sending any array to to the server I get this error.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/asynction/validation.py", line 26, in jsonschema_validate_with_error_handling
jsonschema.validate(instance, schema)
File "/usr/local/lib/python3.9/site-packages/jsonschema/validators.py", line 967, in validate
raise error
jsonschema.exceptions.ValidationError: ([],) is not of type 'array'
Failed validating 'type' in schema:
{'type': 'array'}
On instance:
([],)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
File "/usr/local/lib/python3.9/site-packages/socketio/server.py", line 720, in _handle_event_internal
r = server._trigger_event(data[0], namespace, sid, *data[1:])
File "/usr/local/lib/python3.9/site-packages/socketio/server.py", line 745, in _trigger_event
return self.handlers[namespace][event](*args)
File "/usr/local/lib/python3.9/site-packages/flask_socketio/__init__.py", line 282, in _handler
return self._handle_event(handler, message, namespace, sid,
File "/usr/local/lib/python3.9/site-packages/flask_socketio/__init__.py", line 766, in _handle_event
ret = handler(*args)
File "/usr/local/lib/python3.9/site-packages/asynction/validation.py", line 97, in handler_with_validation
validate_payload(args, message.payload)
File "/usr/local/lib/python3.9/site-packages/asynction/validation.py", line 57, in validate_payload
jsonschema_validate_payload(args, schema)
File "/usr/local/lib/python3.9/site-packages/asynction/validation.py", line 28, in jsonschema_validate_with_error_handling
raise exc_type(str(e))
asynction.exceptions.PayloadValidationException: ([],) is not of type 'array'
Failed validating 'type' in schema:
{'type': 'array'}
On instance:
([],)
2021-12-15T20:29:58Z <Thread at 0x7feeac4cc480: <bound method Server._handle_event_internal of <socketio.server.Server object at 0x7feead801700>>(<socketio.server.Server object at 0x7feead801700>, '0Fn-hKNPKV47OogIAAAF', 'HR_USU2XamBt4DyHAAAE', ['subscriptions', []], '/subscriptions/', 3)> failed with PayloadValidationException
And the error was no longer present.
Though this does seem to go against the logic in place for the special case provided there.
Why is this special case there?
This issue only seems to occur when the top level payload object type is an array.
The else case seems to handle that, but the "array" case seems to assume that the args
is the array itself