refactor: expose generated code and client business logic to share with Kapacitor (#103)
* refactor: take clients out of internal * refactor: move stdio to pkg * Move internal/api to api * refactor: final changes for Kapacitor to access shared functionality * chore: regenerate mocks * fix: bad automated refactor * chore: extra formatting not caught by make fmt
This commit is contained in:
parent
d54aa9ec2d
commit
9747d05ae1
4
.gitignore
vendored
4
.gitignore
vendored
@ -17,5 +17,5 @@ dist/
|
||||
vendor/
|
||||
|
||||
# Docs generated from our openapi repo
|
||||
internal/api/cli.yml
|
||||
internal/api/cli.gen.yml
|
||||
api/cli.yml
|
||||
api/cli.gen.yml
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "openapi"]
|
||||
path = internal/api/contract/openapi
|
||||
path = api/contract/openapi
|
||||
url = ../openapi
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influx-cli/v2/internal/api"
|
||||
"github.com/influxdata/influx-cli/v2/api"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# API Contract
|
||||
|
||||
This directory contains the source YMLs used to drive code generation of HTTP clients in [`internal/api`](../).
|
||||
This directory contains the source YMLs used to drive code generation of HTTP clients in [`api`](../).
|
||||
|
||||
## YML Structure
|
||||
|
||||
@ -25,29 +25,29 @@ 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:
|
||||
```shell
|
||||
cd internal/api/contract/openapi && git checkout -b <new-branch-name>
|
||||
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:
|
||||
```shell
|
||||
make openapi
|
||||
# Use `git status` to see new/modified files under `internal/api`
|
||||
# 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
|
||||
```shell
|
||||
cd internal/api/contract/openapi && git push <your-branch-name>
|
||||
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:
|
||||
```shell
|
||||
cd internal/api/contract/openapi && git fetch && git checkout master && git pull origin master
|
||||
cd api/contract/openapi && git fetch && git checkout master && git pull origin master
|
||||
```
|
||||
4. Update the submodule reference from the main repo:
|
||||
```shell
|
||||
git add internal/api/contract/openapi
|
||||
git add api/contract/openapi
|
||||
git commit
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user