Skip to content

Commit f84bc0c

Browse files
author
Evan Rademacher
committed
Dockerize code generation
- Added a docker-compose spec that uses an openapitools image for codegen - Reran client gen, which added a missing file for the alternate AddAllowListEntry binding - Renamed 'ccloud' dir to 'openapi-generator'
1 parent 0133736 commit f84bc0c

File tree

9 files changed

+522
-233
lines changed

9 files changed

+522
-233
lines changed

Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
.PHONY: generate-openapi-client
44
generate-openapi-client:
55
rm -rf ./pkg/client/*.go docs
6-
openapi-generator generate -g go -i internal/spec/swagger.json -o internal/ccloud \
7-
-c internal/spec/config.yaml -t internal/spec
8-
mv internal/ccloud/docs ./
9-
mv internal/ccloud/*.md ./docs/
10-
mv ./internal/ccloud/api_cockroach_cloud.go ./internal/ccloud/service.go
11-
go fmt ./internal/ccloud/...
12-
mv ./internal/ccloud/*.go pkg/client/
6+
docker-compose -f ./docker-compose.yml run --rm \
7+
openapi-generator generate \
8+
-g go \
9+
-i internal/spec/swagger.json \
10+
-o internal/openapi-generator \
11+
-c internal/spec/config.yaml \
12+
-t internal/spec
13+
mv internal/openapi-generator/docs ./
14+
mv internal/openapi-generator/*.md ./docs/
15+
mv ./internal/openapi-generator/api_cockroach_cloud.go ./internal/openapi-generator/service.go
16+
go fmt ./internal/openapi-generator/...
17+
mv ./internal/openapi-generator/*.go pkg/client/
1318
@$(MAKE) add-boilerplate
1419

1520
# Add boilerplate header to all pkg golang files.

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3'
2+
3+
services:
4+
openapi-generator:
5+
image: openapitools/openapi-generator-cli:v6.2.0
6+
volumes:
7+
- ./:/go/src/github.com/cockroachdb/cockroach-cloud-sdk-go
8+
working_dir: /go/src/github.com/cockroachdb/cockroach-cloud-sdk-go

internal/ccloud/.openapi-generator/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.2.0

internal/ccloud/api/openapi.yaml renamed to internal/openapi-generator/api/openapi.yaml

Lines changed: 366 additions & 224 deletions
Large diffs are not rendered by default.

internal/spec/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Install `openapi-generator`.
2929
- `brew install openapi-generator`
3030
- [OpenAPI Generator doc: Installation](https://openapi-generator.tech/docs/installation/)
3131

32-
Do not delete [.openapi-generator-ignore](../ccloud/.openapi-generator-ignore)! It prevents certain files from being generated.
32+
Do not delete [.openapi-generator-ignore](../openapi-generator/.openapi-generator-ignore)! It prevents certain files from being generated.
3333

3434
To regenerate the ccloud Go API Client code using the files in this directory, use `make generate-openapi-client`.
3535
The `openapi-generator` cli can also be used like:

pkg/client/model_allowlist_entry_1.go

Lines changed: 134 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)