-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (25 loc) · 1.08 KB
/
Makefile
File metadata and controls
30 lines (25 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.PHONY:gen format lint gen-schema-registry-client
gen: gen-mocks gen-schema-registry-client
gen-mocks:
mockery
gen-schema-registry-client:
@echo "Fetching OpenAPI schema from Redpanda..."
@mkdir -p gen/schema-registry
@curl -sSL https://docs.redpanda.com/api/doc/schema-registry.yaml -o gen/schema-registry/openapi2.yaml
@echo "Converting OpenAPI 2.0 to OpenAPI 3.0..."
@curl -sSL -X POST "https://converter.swagger.io/api/convert" \
-H "Content-Type: application/yaml" \
-H "Accept: application/yaml" \
--data-binary @gen/schema-registry/openapi2.yaml \
-o gen/schema-registry/openapi.yaml
@echo "Generating Go HTTP client..."
@cd gen/schema-registry && go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config oapi-codegen.yaml openapi.yaml
@echo "Formatting generated code..."
@go fmt ./gen/schema-registry/client.go
@echo "Cleaning up schema files..."
@rm -f gen/schema-registry/openapi2.yaml gen/schema-registry/openapi.yaml
@echo "Schema registry client generated successfully in gen/schema-registry/client.go"
lint:
golangci-lint run
format:
golangci-lint fmt