Project

General

Profile

Actions

Feature #2317

closed

API: Wrong search operators in OpenAPI file

Added by Olivia Reichl 3 months ago. Updated 12 days ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Start date:
2024-06-17
Estimated time:

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.


Related issues 1 (0 open1 closed)

Related to OpenAtlas - Feature #2346: API: 0.4.4ClosedBernhard Koschiček-Krombholz2024-09-04Actions
Actions #1

Updated by Alexander Watzinger 3 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']:
        ~~~~~~^^^^^^^^^^^^
Actions #2

Updated by Bernhard Koschiček-Krombholz 3 months ago

Will try to fix it. It is quite hard, because the search is not in a format that swagger handles well.

Actions #3

Updated by Alexander Watzinger 3 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.

Actions #4

Updated by Bernhard Koschiček-Krombholz 26 days ago

  • Assignee set to Bernhard Koschiček-Krombholz
Actions #5

Updated by Bernhard Koschiček-Krombholz 25 days 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

Actions #6

Updated by Bernhard Koschiček-Krombholz 24 days ago

I created a working example.

Actions #7

Updated by Bernhard Koschiček-Krombholz 24 days ago

Actions #8

Updated by Bernhard Koschiček-Krombholz 12 days ago

  • Subject changed from API: Swaggerfile is missing operator to execute properly to API: Wrong search operators in OpenAPI file
Actions

Also available in: Atom PDF