Skip to content

Commit de9b33d

Browse files
committed
chore: improve OpenAPI spec generation and add dev docs
1 parent dee9e27 commit de9b33d

3 files changed

Lines changed: 768 additions & 592 deletions

File tree

v2/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ openapi-v3-gen:
3838
query_services.proto
3939
@echo "Cleaning up OpenAPI spec..."
4040
cd "$(PROTO_DIR)" && \
41-
yq -i 'del(.paths."/health")' query_services.openapi.yaml && \
42-
yq -i '(.tags[] | select(.name == "ArchiveQueryService")).x-scalar-ignore = true' query_services.openapi.yaml && \
43-
yq -i '(.paths[][].tags) -= ["ArchiveQueryService"]' query_services.openapi.yaml
41+
yq -i --indent 4 'del(.paths."/health")' query_services.openapi.yaml && \
42+
yq -i --indent 4 '(.tags[] | select(.name == "ArchiveQueryService")).x-scalar-ignore = true' query_services.openapi.yaml && \
43+
yq -i --indent 4 '(.tags[] | select(.name == "Events (Beta)")).x-scalar-ignore = true' query_services.openapi.yaml && \
44+
yq -i --indent 4 '(.paths[][].tags) -= ["ArchiveQueryService"]' query_services.openapi.yaml
4445

4546
test-cover:
4647
@echo "Performing Go cover test..."

v2/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,5 +223,16 @@ See [messages.proto](api/archive-query-service/v2/messages.proto)
223223
and [query_services.proto](api/archive-query-service/v2/query_services.proto)
224224
for full details.
225225

226+
## Regenerating protobuf and OpenAPI files
227+
228+
Run `make` (or `make all`) to regenerate all protobuf and OpenAPI files.
229+
230+
### Dev dependencies
231+
232+
- `protoc` with Go plugins (`protoc-gen-go`, `protoc-gen-go-grpc`, `protoc-gen-grpc-gateway`)
233+
- `protoc-gen-openapi` (`go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest`)
234+
- `yq` - used for OpenAPI post-processing (`brew install yq` on macOS, `snap install yq` on Linux,
235+
`choco install yq` on Windows, or [GitHub releases](https://github.com/mikefarah/yq/releases))
236+
226237
## Caching
227238
See [CACHE.md](CACHE.md) for details about enabling and using caching in Archive Query Service v2.

0 commit comments

Comments
 (0)