Files
influx-cli/api/contract
Andrew Lee c695e601a5 Add REPL autocompletion & go-prompt (#392)
* add v1-compatible query path and refactor other paths to de-duplicate "/query"

* add initial influxQL repl

* add ping endpoint to schema

* improve prompt UX, implement some commands

* fix json column type in schema and improve completion

* feat: add table formatter and move to forked go-prompt

* improve formatting and add table pagination

* implement more REPL commands, including insert and history

* implement "INSERT INTO"

* move repl command to "v1 repl"

* refactor and improve documentation

* clean up v1_repl cmd

* update to latest openapi, use some openapi paths instead of overrides

* remove additional files that were moved to openapi

* compute historyFilePath at REPL start

* clean up REPL use command logic flow

* clean up comments for TODOs now in issues

* move gopher (chonky boi)

* remove autocompletion for separate PR

* run go mod tidy

* add back autocompletion & go-prompt

* add rfc3339 precision option

* allow left and right column scrolling to display whole table

* add error to JSON query response

* add tags and partial to JSON response series schema

* fix csv formatting and add column formatting

* remove table format for separate PR

* fix getDatabases

* move from write to legacy write endpoint for INSERT

* remove history vestiges

* allow multiple spaces in INSERT commands

* add precision comment

* remove auth for separate PR

* separate parseInsert and add unit test

* add additional test case and improve error messages

* fix missing errors import

* fix format suggestion

* re-add history implementation with history limit

* build: upgrade to Go 1.18.3 (#395)

* feat: add back the InfluxQL REPL (#386)

* add v1-compatible query path and refactor other paths to de-duplicate "/query"

* add initial influxQL repl

* add ping endpoint to schema

* improve prompt UX, implement some commands

* fix json column type in schema and improve completion

* feat: add table formatter and move to forked go-prompt

* improve formatting and add table pagination

* implement more REPL commands, including insert and history

* implement "INSERT INTO"

* move repl command to "v1 repl"

* refactor and improve documentation

* clean up v1_repl cmd

* update to latest openapi, use some openapi paths instead of overrides

* remove additional files that were moved to openapi

* compute historyFilePath at REPL start

* clean up REPL use command logic flow

* clean up comments for TODOs now in issues

* move gopher (chonky boi)

* remove autocompletion for separate PR

* run go mod tidy

* add rfc3339 precision option

* allow left and right column scrolling to display whole table

* add error to JSON query response

* add tags and partial to JSON response series schema

* fix csv formatting and add column formatting

* remove table format for separate PR

* fix getDatabases

* move from write to legacy write endpoint for INSERT

* remove history vestiges

* allow multiple spaces in INSERT commands

* add precision comment

* remove auth for separate PR

* separate parseInsert and add unit test

* add additional test case and improve error messages

* fix missing errors import

* print rfc3339 precision

* add rfc3339 to help output

* run tidy

* restructure autocomplete and handle review items

* improve autocompletion with leftover handling

* improve comments and add autocomplete for DELETE & DROP MEASUREMENT

* rename repl to shell

* remove unsupported CREATE & DROP autocompletions

* additional refactor for autocompletion

Co-authored-by: Dane Strandboge <dstrandboge@influxdata.com>
2022-06-14 15:18:27 -06:00
..

API Contract

This directory contains the source YMLs used to drive code generation of HTTP clients in api.

YML Structure

Most YMLs used here are pulled from the source-of-truth openapi repo via a git submodule. In rare cases, the full description of an API is too complex for our codegen tooling to handle; the overrides/ directory contains alternate definitions for paths/schemas that work around these cases. cli.yml ties together all the pieces by linking all routes and schemas used by the CLI.

Updating the API contract

To extend/modify the API contract used by the CLI, first make sure the openapi submodule is cloned and up-to-date:

# Run from the project root.
git submodule update --init --recursive

Then create a new branch to track your work:

git checkout <new-branch-name>

Next, decide if any modifications are needed in the source-of-truth openapi repo. If so, create a branch in the submodule to track changes there:

cd api/contract/openapi && git checkout -b <new-branch-name>

Edit/add to the files under api-contract/ to describe the new API contract. Run the following from the project root test your changes and see the outputs in Go code:

make openapi
# Use `git status` to see new/modified files under `api`

Once you're happy with the new API contract, submit your changes for review & merge. If you added/edited files within openapi, you'll first need to:

  1. Push your submodule branch to GitHub
    cd api/contract/openapi && git push <your-branch-name>
    
  2. Create a PR in openapi, eventually merge to master there
  3. Update your submodule to point at the merge result:
    cd api/contract/openapi && git fetch && git checkout master && git pull origin master
    
  4. Update the submodule reference from the main repo:
    git add api/contract/openapi
    git commit