Skip to content

Commit 48775e5

Browse files
authored
chore: split apply-overlay tool (#3742)
1 parent 4bff7a8 commit 48775e5

28 files changed

+79638
-497
lines changed

.github/workflows/autoupdate-spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
id: verify-changed-files
2222
with:
2323
files: |
24-
./tools/cmd/api-generator/spec.yaml
24+
./tools/internal/specs/spec.yaml
2525
- run: make gen-api-commands
2626
if: steps.verify-changed-files.outputs.files_changed == 'true'
2727
- run: make gen-docs

Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,20 @@ addcopy: ## Add missing license to files
105105
.PHONY: generate
106106
generate: gen-docs gen-mocks gen-api-commands ## Generate docs, mocks, code, api commands, all auto generated assets
107107

108+
.PHONY: apply-overlay
109+
apply-overlay: ## Apply overlay on openapi spec
110+
@echo "==> Applying overlay"
111+
go run ./tools/cmd/apply-overlay --spec ./tools/internal/specs/spec.yaml --overlay ./tools/internal/specs/overlays/\*.yaml > ./tools/internal/specs/spec-with-overlays.yaml
112+
108113
.PHONY: gen-api-commands
109-
gen-api-commands: ## Generate api commands
114+
gen-api-commands: apply-overlay ## Generate api commands
110115
@echo "==> Generating api commands"
111-
go run ./tools/cmd/api-generator --spec ./tools/cmd/api-generator/spec.yaml --overlay ./tools/cmd/api-generator/overlays --output-type commands > ./internal/api/commands.go
112-
go run ./tools/cmd/api-generator --spec ./tools/cmd/api-generator/spec.yaml --overlay ./tools/cmd/api-generator/overlays --output-type metadata > ./tools/cmd/docs/metadata.go
116+
go run ./tools/cmd/api-generator --spec ./tools/internal/specs/spec-with-overlays.yaml --output-type commands > ./internal/api/commands.go
117+
118+
.PHONY: gen-docs-metadata
119+
gen-docs-metadata: apply-overlay ## Generate docs metadata
120+
@echo "==> Generating docs metadata"
121+
go run ./tools/cmd/api-generator --spec ./tools/internal/specs/spec-with-overlays.yaml --output-type metadata > ./tools/cmd/docs/metadata.go
113122

114123
.PHONY: otel
115124
otel: ## Generate code
@@ -122,7 +131,7 @@ gen-mocks: ## Generate mocks
122131
go generate ./internal...
123132

124133
.PHONY: gen-docs
125-
gen-docs: ## Generate docs for atlascli commands
134+
gen-docs: gen-docs-metadata ## Generate docs for atlascli commands
126135
@echo "==> Generating docs"
127136
go run -ldflags "$(LINKER_FLAGS)" ./tools/cmd/docs
128137

scripts/update-openapi-spec.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ set -euo pipefail
2020
SCRIPT_DIR="${BASH_SOURCE%/*}"
2121

2222
# Download the file using curl
23-
curl -L "https://github.com/mongodb/openapi/raw/refs/heads/main/openapi/v2.yaml" -o "${SCRIPT_DIR}/../tools/cmd/api-generator/spec.yaml"
23+
curl -L "https://github.com/mongodb/openapi/raw/refs/heads/main/openapi/v2.yaml" -o "${SCRIPT_DIR}/../tools/internal/specs/spec.yaml"

tools/cmd/api-generator/.snapshots/05-spec-with-overlay.yaml-commands.snapshot

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)