influxdata / influxdata/influxdb
maximum value of limit query param in get buckets request is being ignored
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
According to the swagger doc, `limit` query param of GET `/bucket` request should be between `1` and `100` and if it is outside of this range, then error message would be returned:
```
"code": "invalid",
"message": "limit must be between 1 and 100"
```
Currently, if `limit` param is set to a value greater than `100`, success status is returned along with the list of all of the buckets.
Swagger doc (L6520-6528):
```
Limit:
in: query
name: limit
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
```
Expected:
```
2020-11-16 21:35:44,949-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response status_code = 400
2020-11-16 21:35:44,950-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response headers = {'Content-Type': 'application/json; charset=utf-8', 'X-Platform-Error-Code': 'invalid', 'Date': 'Mon, 16 Nov 2020 21:35:44 GMT', 'Content-Length': '69'}
2020-11-16 21:35:44,950-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response url = http://localhost:8086/api/v2/buckets?orgID=895fc39eaec859b1&limit=150
2020-11-16 21:35:44,950-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response text = {
"code": "invalid",
"message": "limit must be between 1 and 100"
}
```
Actual:
```
2020-11-18 02:23:34,473-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response status_code = 200
2020-11-18 02:23:34,474-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response headers = {'Content-Type': 'application/json; charset=utf-8', 'Date': 'Wed, 18 Nov 2020 02:23:34 GMT', 'Transfer-Encoding': 'chunked'}
2020-11-18 02:23:34,474-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response url = http://localhost:8086/api/v2/buckets?orgID=650affd6f18c6e92&limit=150
2020-11-18 02:23:34,474-src.cloud.rest_api.buckets.test_gateway_get_all_buckets-INFO-RestLib.get() - response text = {
"links": {
"self": "/api/v2/buckets?descending=false\u0026limit=150\u0026offset=0\u0026orgID=650affd6f18c6e92"
},
"buckets": [
{
"id": "4ccf191885d85b69",
"orgID": "650affd6f18c6e92",
"type": "system",
"description": "System bucket for monitoring logs",
"name": "_monitoring",
"retentionRules": [
{
"type": "expire",
"everySeconds": 604800
}
],
"createdAt": "2020-11-18T02:23:33.351260162Z",
"updatedAt": "2020-11-18T02:23:33.351260342Z",
"links": {
"labels": "/api/v2/buckets/4ccf191885d85b69/labels",
"members": "/api/v2/buckets/4ccf191885d85b69/members",
"org": "/api/v2/orgs/650affd6f18c6e92",
"owners": "/api/v2/buckets/4ccf191885d85b69/owners",
"self": "/api/v2/buckets/4ccf191885d85b69",
"write": "/api/v2/write?org=650affd6f18c6e92\u0026bucket=4ccf191885d85b69"
},
"labels": []
},
{
....
```
```
Contributor guide
Research direction
Start with the bucket-listing endpoint and compare its request validation with the Swagger definition at L6520-L6528. Use the gateway test context named src.cloud.rest_api.buckets.test_gateway_get_all_buckets and exercise limit=150. Done means an out-of-range limit returns HTTP 400 with code invalid and the message "limit must be between 1 and 100".
Written by the indexing model from the issue text.
Assessment
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100