influxdata / influxdata/influxdb

InfluxDB 2 API: Documents Service implementation doesn't cover the swagger definition

Open
#20,163 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/2.x
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

The following specification of /documents/templates allow to create Template but https://github.com/influxdata/influxdb/commit/5954db8c4d3881c30e452a9131904b06972edfd3 introduces read-only document store.

https://github.com/influxdata/influxdb/blob/6303937b93950b696ce3ff3702e266b685418048/http/swagger.yml#L144

  /documents/templates:
    get:
      operationId: GetDocumentsTemplates
      tags:
        - Templates
      parameters:
        - $ref: "#/components/parameters/TraceSpan"
        - in: query
          name: org
          description: Specifies the name of the organization of the template.
          schema:
            type: string
        - in: query
          name: orgID
          description: Specifies the organization ID of the template.
          schema:
            type: string
      responses:
        "200":
          description: A list of template documents
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Documents"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    post:
      operationId: PostDocumentsTemplates
      tags:
        - Templates
      summary: Create a template
      parameters:
        - $ref: "#/components/parameters/TraceSpan"
      requestBody:
        description: Template that will be created
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentCreate"
      responses:
        "201":
          description: Template created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Document"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

  1. Cannot retrieve DocumentTemplates by org Name
--> GET http://127.0.0.1:9999/api/v2/documents/templates?org=org1606209676706-IT
<-- 400 Bad Request http://127.0.0.1:9999/api/v2/documents/templates?org=org1606209676706-IT 
<-- {"code":"invalid","message":"invalid org id for permission: invalid ID"}
  1. Cannot create DocumentTemplate
--> POST http://127.0.0.1:9999/api/v2/documents/templates
--> {"meta":{"name":"document-name1606209306216-IT","version":"1"},"content":"templates content","orgID":"cb6bc76225fdfc6c","labels":["06aa61988a5c8000"]}
<-- 405 Method Not Allowed http://127.0.0.1:9999/api/v2/documents/templates 

cc @GeorgeMac

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with http/swagger.yml at the /documents/templates definition and reproduce the GET request with an organization name and the POST request shown in the issue. Trace the Documents Service handlers and permission lookup for these endpoints. Done means the implemented behavior matches the documented read and create operations, including organization-name lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.