Feature #2317
closedAPI: Wrong search operators in OpenAPI file
Description
The search parameter "operator" seem to be mandatory, but cannot be entered via the Swagger interface.
https://demo.openatlas.eu/swagger/#/Entities%20Endpoint/GetQuery
This only affects the Swagger execution, the endpoint works fine.
Updated by Alexander Watzinger 5 months ago
Here some output I get from the server logs about that:
File "/var/www/openatlas/mamems/openatlas/api/endpoints/parser.py", line 70, in __init__
self.set_search_param()
File "/var/www/openatlas/mamems/openatlas/api/endpoints/parser.py", line 82, in set_search_param
check_search_parameters(category, values)
File "/var/www/openatlas/mamems/openatlas/api/resources/search_validation.py", line 16, in check_search_parameters
if values['operator'] not in app.config['COMPARE_OPERATORS']:
~~~~~~^^^^^^^^^^^^
Updated by Bernhard Koschiček-Krombholz 5 months ago
Will try to fix it. It is quite hard, because the search is not in a format that swagger handles well.
Updated by Alexander Watzinger 5 months ago
- Target version changed from 8.7.0 to 8.9.0
Thanks for feedback. If it is just about Swagger it's definitely not urgent enough to interrupt your time off (or my time to try to figure it on my own).
I just noticed it when looking with Olivia at other issues and pressed Olivia to create an issues because it might be a bug and bugs always should be documented (and of course solved at some point).
I also wasn't sure what exactly the problem is and was hoping it might just need a minor code fix like e.g. changing:
if values['operator'] not in app.config['COMPARE_OPERATORS']:
To
if 'operator' not in values or values['operator'] not in app.config['COMPARE_OPERATORS']:
Anyway, I really don't have enough insight on this and to express that it isn't that urgent, I put it further back on the roadmap.
Updated by Bernhard Koschiček-Krombholz 2 months ago
- Assignee set to Bernhard Koschiček-Krombholz
Updated by Bernhard Koschiček-Krombholz 2 months ago
- Status changed from Acknowledged to Closed
- Target version changed from 8.9.0 to 8.7.0
Thank you, I found the error in the OpenAPI specification and fixed it.
The list should now look like this:
... "entityAliases": [ { "logicalOperator": "AND", "operator": "equal", "values": [ "string", 0 ] } ], "entityCidocClass": [ { "logicalOperator": "AND", "operator": "equal", "values": [ "string", 0 ] } ], ...
Since it is a text field, I cannot make it in the swagger UI as chooseable options, but now everything should show up. I will try to make only one example or none, that it is easier for the user
Updated by Bernhard Koschiček-Krombholz 2 months ago
I created a working example.
Updated by Bernhard Koschiček-Krombholz 2 months ago
- Related to Feature #2346: API: 0.4.4 added
Updated by Bernhard Koschiček-Krombholz 2 months ago
- Subject changed from API: Swaggerfile is missing operator to execute properly to API: Wrong search operators in OpenAPI file