Getting unexpected error responses when using minSchemaVersion or maxSchemaVersion #1128
Labels
area/registry
Devfile registry for stacks and infrastructure
kind/bug
Something isn't working
severity/blocker
Issues that prevent developers from working
Which area this feature is related to?
/kind bug
Which area this bug is related to?
/area registry
What versions of software are you using?
Go project
Operating System and version: N/A
Go Pkg Version: 1.18
Bug Summary
While working on redhat-developer/alizer#226 I've experienced a 500 error when I've tried to use a URL params for minSchemaVersion and maxSchemaVersion. More detailed when I've tried to use a version older than 2.x or with 3 digits like 2.x.x I'm getting a 500 response.
This error might be existing due to this code: https://github.com/devfile/registry-support/blob/200b4f015149a2c23314ea2ef83711869e4d09c9/index/server/pkg/server/endpoint.go#L432
Adding this as a bug, as I would expect a 400 status code instead of 500. Additionally I think we should might add the range of accepted versions here: https://github.com/devfile/registry-support/blob/main/index/server/registry-REST-API.adoc#query-parameters
To Reproduce:
Reproduces error for passing three digit devfile version:
Reproduces unexpected 500 internal server error:
curl -o - -i "https://registry.devfile.io/v2index?minSchemaVersion=1.1&maxSchemaVersion=1.4"
Expected behavior
Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable
Additional context
Any workaround?
None.
Suggestion on how to fix the bug
Fix validation to allow the optional use of the bugfix part of the devfile version number and the response for invalid request parameters should be changed from 500 internal server error to 400 bad request.
Target Date: 06-27-2023
The text was updated successfully, but these errors were encountered: