-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Bug Description
When computing a ratio, "Infinity"
may be returned in the ratio
property. I understand that a division by 0 would lead to this result, but a client application using the Ohsome API expecting a number in that property could crash if the string "Infinity"
is returned.
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
- Remote instance at
- Affected endpoint(s) [e.g. /contributions/count]
- /elements/area/ratio/groupBy/boundary
- URL of your request (and request body if applicable)
https://api.ohsome.org/v1/elements/area/ratio/groupBy/boundary?keys=highway&types2=line%2Cpolygon%2C&values=platform&showMetadata=no&filter2=%2C%2CGmeKA%5Cx1%26x%3E%7EX&bpolys=C%3A8.704561%2C49.403252%2C8.7074%2C49.422%2C8.74276%2C49.429%2C8.72575%2C49.420%2C8.704561%2C49.403252
- Used HTTP method [GET or POST]
- GET
- Utilized tool/library for the request [e.g. cURL, Postman, ohsome-py, etc.]
Expected Behaviour
The value in the ratio
property should conform to the API specification. I see two possible ways of fixing this: a) either not returning "Infinity"
at all; or b) define this property using the oneOf
keyword of the OpenAPI specification (see https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/).
As an additional issue, the API request uses an invalid value for parameter filter2
(",,GmeKA\x1&x>~X"
). Shouldn't the API response be a 400 status code (client error)?
The OpenAPI specification I am referring to is available at:
- [UI] https://api.ohsome.org/v1/swagger-ui.html
- [JSON] https://api.ohsome.org/v1/docs?group=Data%20Aggregation
Further Information
Error Messages, Logs, Screenshots
See attached screenshot.
Additional Information
A test report revealing this issue is available at the following URL (it might take some time to load):