ireceptor-plus / issues

0 stars 0 forks source link

empty statistics list in request for stats API? #99

Closed schristley closed 2 years ago

schristley commented 2 years ago

What should be the behavior for an empty or non-existent statistics object in the request? For example, in requests like this:

curl -X POST https://vdj-staging.tacc.utexas.edu/irplus/v1/stats/rearrangement/count

curl --data '{"statistics":[]}' https://vdj-staging.tacc.utexas.edu/irplus/v1/stats/rearrangement/count

Should this be an error, that is, we require the user to specify at least one statistic? Or should this just return an empty list of statistics?

bcorrie commented 2 years ago

Currently we return an error on:

curl -X POST https://vdj-staging.tacc.utexas.edu/irplus/v1/stats/rearrangement/count

The error being can't parse JSON, which seems correct, there is no JSON and there should be...

Currently we return an empty response on:

curl --data '{"statistics":[]}' https://vdj-staging.tacc.utexas.edu/irplus/v1/stats/rearrangement/count

Which kind of makes sense to me, since you are asking for stats but aren't asking for anything that it provides - so you get nothing.

This also returns an empty response:

curl --data '{}' http://covid19-1.ireceptor.org/irplus/v1/stats/rearrangement/count

Valid JSON, but no stats requested so no stats returned...

schristley commented 2 years ago

My openapi middleware considers this:

curl -X POST https://vdj-staging.tacc.utexas.edu/irplus/v1/stats/rearrangement/count

to be the same as this:

curl --data '{}' http://covid19-1.ireceptor.org/irplus/v1/stats/rearrangement/count

that is, I get a an empty object {} in my handler, so no way for me to distinguish between the two really.

Currently we return an empty response on:

curl --data '{"statistics":[]}' https://vdj-staging.tacc.utexas.edu/irplus/v1/stats/rearrangement/count

Ok, I'll return an empty list instead of an error.