Skip to content

Commit

Permalink
Add Swagger JSON definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Nov 11, 2019
1 parent 29e4144 commit 8d28dba
Show file tree
Hide file tree
Showing 21 changed files with 7,161 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.PHONY: go
.PHONY: go swagger

all: go swagger

go:
cd go && make

swagger:
cd swagger && make
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/brocaar/chirpstack-api/go

go 1.12
go 1.13

require (
github.com/golang/protobuf v1.3.2
Expand Down
28 changes: 28 additions & 0 deletions swagger/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.PHONY: requirements as-external-api

GRPC_GW_PATH := $(shell go list -f '{{ .Dir }}' github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway)
GOOGLEAPIS_PATH := "$(GRPC_GW_PATH)/../third_party/googleapis"

all: requirements as-external-api

requirements:
@go mod download
@go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
@go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway

as-external-api:
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/application.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/common.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/device.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/deviceProfile.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/deviceQueue.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/fuotaDeployment.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/gateway.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/gatewayProfile.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/internal.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/multicastGroup.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/networkServer.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/organization.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/profiles.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/serviceProfile.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../protobuf/as/external/api --swagger_out=json_names_for_fields=true:. as/external/api/user.proto
Loading

0 comments on commit 8d28dba

Please sign in to comment.