influxdata / influxdata/influxdb
InfluxDB 2: List all labels for a template is null instead of empty array
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
The list of all labels for a template should be empty array instead of null if there is no one.
```bash
# Create template
--> POST http://127.0.0.1:9999/api/v2/documents/templates
--> {"meta":{"name":"document-name1584085373830-IT","version":"1"},"content":"templates content","orgID":"8fddb6e6c18dd499","labels":[]}
<-- 201 Created http://127.0.0.1:9999/api/v2/documents/templates
<-- {
"links": {
"self": "/api/v2/documents/templates/0560b57dea990000"
},
"id": "0560b57dea990000",
"meta": {
"name": "document-name1584085373830-IT",
"version": "1",
"createdAt": "2020-03-13T07:42:53.8662117Z",
"updatedAt": "2020-03-13T07:42:53.8662266Z"
},
"content": "templates content"
}
### List all labels
--> GET http://127.0.0.1:9999/api/v2/documents/templates/0560b57dea990000/labels
<-- 200 OK http://127.0.0.1:9999/api/v2/documents/templates/0560b57dea990000/labels
<-- {"links":{"self":"/api/v2/labels"},"labels":null}
```
__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.
1. Create new Template
2. List labels for template
__Expected behavior:__
```
{"links":{"self":"/api/v2/labels"},"labels":[]}
```
__Actual behavior:__
```
{"links":{"self":"/api/v2/labels"},"labels":null}
```
__Environment info:__
* InfluxDB version: docker v2.0.0-beta.6, latest nightly build
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with POST /api/v2/documents/templates using an empty labels array, then GET /api/v2/documents/templates/{id}/labels. Trace the API entry point that builds the labels response. Done means the endpoint returns "labels":[] when the template has no labels, while preserving the documented links and status response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100