GIScience/ohsome-api

[Mismatch between API response and API specification] Properties with wrong type

apibugsreporting opened this issue · 0 comments

Bug Description

The following API request obtains a response that contains inconsistencies with respect to the API specification.

General Information

Please include the following general information about the issue and list any additional steps needed to reproduce the bug.

  • Version of the ohsome API [e.g. 1.5.0]
    • 1.6.1
  • Which API instance was requested [e.g. remote instance at https://api.ohsome.org/v1, local instance with an h2 file or connected to the cluster, etc.]
    • Remote instance at https://api.ohsome.org/v1
  • Affected endpoint(s) [e.g. /contributions/count]
    • /elements/area/groupBy/type
    • /elements/length/groupBy/boundary/groupBy/tag
    • /elements/area/groupBy/boundary/groupBy/tag
    • /users/count/groupBy/key
    • /elements/perimeter/density/groupBy/boundary/groupBy/tag
    • There may be more.
  • URL of your request (and request body if applicable)
    • https://api-test.ohsome.org/v1/elements/length/groupBy/boundary/groupBy/tag?groupByValues=church%2Cresidential%2Cdemolished&bboxes=y%3A8.687%2C49.4058%2C8.7105%2C49.3911%7CGE%3A8.6889%2C49.421%2C8.74470%2C49.384%7CJYKz%3A8.669763%2C49.412%2C8.7194%2C49.396%7CNm%3A8.675141%2C49.409%2C8.71685%2C49.39159&groupByKey=building&keys=highway&values=cycleway&time=2013-06-18&timeout=53
  • Used HTTP method [GET or POST]
    • Both
  • Utilized tool/library for the request [e.g. cURL, Postman, ohsome-py, etc.]

Expected Behaviour

The property '/groupByResult/[item]/groupByObject' of the response, which should be an object according to the API specification, sometimes is returned as a string or as an array.

A possible way to fix this is to use the oneOf keyword in the OpenAPI specification (see https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/).

The OpenAPI specification I am referring to is available at:

Further Information

Error Messages, Logs, Screenshots

See attached screenshots.

Additional Information

Several test reports revealing this issue are available at the following URLs (they might take some time to load):

Screenshot

Screenshot 2022-02-17 at 15 10 03

Screenshot 2022-02-17 at 15 10 57