Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ratio returns "Infinity" instead of number #262

Open
apibugsreporting opened this issue Feb 17, 2022 · 0 comments
Open

Ratio returns "Infinity" instead of number #262

apibugsreporting opened this issue Feb 17, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@apibugsreporting
Copy link

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
  • 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:

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):

Screenshot

Screenshot 2022-02-17 at 15 49 10

@apibugsreporting apibugsreporting added the bug Something isn't working label Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant