The problem here is caused by not adhering to the case sensitivity of the API.
Perhaps we could have it so that the API first does a query using the exact casing passed by the user. Then, if it can't find anything, it can lowercase everything and check, and then title case everything and check. And if it finds results, it can return back.
Optionally it'd also be useful to return some metadata to the user explaining what happened.
Current behavior
Returns an empty list [ ].
Expected behavior
404 not found or alternative.
Possible solutions
1. In a decorator
Perhaps it is possible to have this functionality in a decorator. But decorators usually run code before the actual function they're wrapped around is called. And in our case, we'd want to run the function first, and then if it didn't return a response, we'd then change the casing and see if we could get a change.
2. Modify all routes
This seems like it would be a lot of work, and probably too cumbersome.
3. Change the nature of routes? From functions to classes?
Not sure how this would be done, or if it is possible from an architectural standpoint. Does Flask or FastAPI support routes as classes instead of functions?
Description
Correct endpoint: https://terminology.ccdh.io/models/CRDC-H/entities Problematic endpoint example: https://terminology.ccdh.io/models/crdc-h/entities
The problem here is caused by not adhering to the case sensitivity of the API.
Perhaps we could have it so that the API first does a query using the exact casing passed by the user. Then, if it can't find anything, it can lowercase everything and check, and then title case everything and check. And if it finds results, it can return back.
Optionally it'd also be useful to return some metadata to the user explaining what happened.
Current behavior
Returns an empty list
[ ]
.Expected behavior
404 not found or alternative.
Possible solutions
1. In a decorator
Perhaps it is possible to have this functionality in a decorator. But decorators usually run code before the actual function they're wrapped around is called. And in our case, we'd want to run the function first, and then if it didn't return a response, we'd then change the casing and see if we could get a change.
2. Modify all routes
This seems like it would be a lot of work, and probably too cumbersome.
3. Change the nature of routes? From functions to classes?
Not sure how this would be done, or if it is possible from an architectural standpoint. Does Flask or FastAPI support routes as classes instead of functions?
4. Swagger-only approach
It might be possible for Swagger to support case insensitivity: https://github.com/go-swagger/go-swagger/issues/303 https://community.smartbear.com/t5/Swagger-Open-Source-Tools/Case-Insensitive-String-parameter-in-schema-of-openApi/td-p/199061