You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the example for indra_subnetwork_relations, there is an error that looks like the payload is badly formatted. The given example is correct, but the swagger docs seems to do some format checking and doesn't allow the example to be sent because of this.
The complaint is that indexes 0 and 1 in the list must be strings, although currently they are lists of strings. Fixing it to comply with the swagger error allows the request to be sent but yields an error on the backend instead (since now the payload is not properly formatted for it):
The backend errors with this:
ERROR: [2024-09-11 19:28:10] indra_cogex.apps.queries_web - norm_id() takes 2 positional arguments but 8 were given
ERROR: [2024-09-11 19:28:10] indra_cogex.apps.wsgi - Exception on /api/indra_subnetwork_relations [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/indra_cogex/apps/queries_web/__init__.py", line 141, in post
result = func_mapping[self.func_name](**parsed_query, client=client)
File "/usr/local/lib/python3.8/dist-packages/indra_cogex/client/neo4j_client.py", line 1130, in _wrapped
rv = func(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/indra_cogex/client/subnetwork.py", line 40, in indra_subnetwork_relations
nodes_str = ", ".join(["'%s'" % norm_id(*node) for node in nodes])
File "/usr/local/lib/python3.8/dist-packages/indra_cogex/client/subnetwork.py", line 40, in <listcomp>
nodes_str = ", ".join(["'%s'" % norm_id(*node) for node in nodes])
TypeError: norm_id() takes 2 positional arguments but 8 were given
I see two solutions worth exploring:
Turn off validation if possible. I quickly tried locally to pass validate=False and format_checker=None to Flask restx's Api() class, but it didn't seem to make a difference, I might have been missing something.
Fix potential source of issue: it looks like the code generating the endpoints assume that all parameters are just lists of strings (coming from parameters being tuples of (namespace, identifier), see queries_web/__init__.py, line 116. In the case above, the parameters is a list of lists (list of tuples in the python code). The fix here would be to make sure the correct flask_restx.fields type is used for the endpoint, perhaps by adding them next to the examples for the parameters.
The text was updated successfully, but these errors were encountered:
When running the example for
indra_subnetwork_relations
, there is an error that looks like the payload is badly formatted. The given example is correct, but the swagger docs seems to do some format checking and doesn't allow the example to be sent because of this.The complaint is that indexes 0 and 1 in the list must be strings, although currently they are lists of strings. Fixing it to comply with the swagger error allows the request to be sent but yields an error on the backend instead (since now the payload is not properly formatted for it):
The backend errors with this:
I see two solutions worth exploring:
validate=False
andformat_checker=None
to Flask restx'sApi()
class, but it didn't seem to make a difference, I might have been missing something.(namespace, identifier)
, seequeries_web/__init__.py
, line 116. In the case above, the parameters is a list of lists (list of tuples in the python code). The fix here would be to make sure the correctflask_restx.fields
type is used for the endpoint, perhaps by adding them next to the examples for the parameters.The text was updated successfully, but these errors were encountered: