diff --git a/Makefile b/Makefile index 020a1c8..dd72cdd 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,7 @@ PROTOC_GEN_VALIDATE_PROTO=${SUBMODULES_DIR}/protoc-gen-validate GOOGLE_OPENAPI_PROTO=${SUBMODULES_DIR}/gnostic/openapiv3 PROTO_OPTION=-I. -I${SUBMODULES_DIR} -I${GOOGLEAPIS_PROTO} -I${GOOGLEPROTOBUF_PROTO} -I${PROTOC_GEN_VALIDATE_PROTO} -I${GOOGLE_OPENAPI_PROTO} PROTO_DOCS_OPTS=${PROTO_OPTION} \ - --plugin=protoc-gen-doc=${BIN_DIR}/protoc-gen-doc \ - --doc_out=./docs + --plugin=protoc-gen-doc=${BIN_DIR}/protoc-gen-doc # GO PROTOC_GO_OPTS=${PROTO_OPTION} \ @@ -112,23 +111,23 @@ clean/go: @rm -rf ${GEN_GO_DIR} .PHONY: release/go -release/go: proto docs +release/go: proto @echo "Publishing go client..." @rm -rf ${TMP_REPO_DIR} && mkdir -p ${TMP_REPO_DIR} @git clone ${REPO}-go.git ${TMP_REPO_DIR}/client-go @cd ${TMP_REPO_DIR}/client-go && git clean -fdx #&& git checkout main @cp $(PWD)/scripts/go/go.mod ${TMP_REPO_DIR}/client-go/go.mod - @cp $(PWD)/docs/README.md ${TMP_REPO_DIR}/client-go/README.md + #@cp $(PWD)/docs/README.md ${TMP_REPO_DIR}/client-go/README.md @cp $(PWD)/CHANGELOG.md ${TMP_REPO_DIR}/client-go/CHANGELOG.md - @cp -R $(PWD)/gen/go/src ${TMP_REPO_DIR}/client-go + @cp -R $(PWD)/gen/go ${TMP_REPO_DIR}/client-go + @rm -rf ${TMP_REPO_DIR}/client-go/**openapi**.* @$(eval NEXT_VERSION=$(shell test $(NEXT_VERSION) && echo $(NEXT_VERSION) || echo $(LAST_TAG))) @cd ${TMP_REPO_DIR}/client-go && git add . && git commit -m "bump(version): $(NEXT_VERSION)" && git tag -a $(NEXT_VERSION) -m '$(NEXT_VERSION)' && git push --tags origin main .PHONY: docs docs: @echo "Generating docs..." - @rm -rf docs && mkdir -p docs - @find proto -name '*.proto' -print0 | xargs -0 -I{} -P${CPUS} protoc ${PROTO_DOCS_OPTS} --doc_opt=markdown,README.md {} + find proto -name '*.proto' -printf '%h\0' | sort -zu | xargs -0 -I{} -P${CPUS} bash -c "d={}; protoc ${PROTO_DOCS_OPTS} --doc_opt=./scripts/markdown.tmpl,README.md:google/* --doc_out=hoguera/platform/"'$$d'" hoguera/platform/"'$$d'"/*.proto" LINT_PLUGIN=${BIN_DIR}/protoc-gen-lint @@ -143,7 +142,7 @@ fmt: @find proto -type f -name "*.proto" | xargs -I{} -P${CPUS} clang-format -i {} .PHONY: changelog -changelog: +changelog: docs @echo "Generating changelog..." @$(eval NEXT_VERSION=$(shell test $(NEXT_VERSION) && echo $(NEXT_VERSION) || echo $(LAST_TAG) | awk -F. '{print $$1"."$$2+1".0"}')) @test $NEXT_VERSION || (echo "NEXT_VERSION is not set"; exit 1) diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index e84b850..0000000 --- a/docs/README.md +++ /dev/null @@ -1,244 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [proto/api/v1/mobile.proto](#proto_api_v1_mobile-proto) - - [Animal](#platform-api-v1-Animal) - - [AnimalsRequest](#platform-api-v1-AnimalsRequest) - - [AnimalsResponse](#platform-api-v1-AnimalsResponse) - - [AreaRequest](#platform-api-v1-AreaRequest) - - [AreaResponse](#platform-api-v1-AreaResponse) - - [Location](#platform-api-v1-Location) - - [LocationRequest](#platform-api-v1-LocationRequest) - - [LocationResponse](#platform-api-v1-LocationResponse) - - [V1Response](#platform-api-v1-V1Response) - - - [Condition](#platform-api-v1-Condition) - - - [Bff](#platform-api-v1-Bff) - - [Internal](#platform-api-v1-Internal) - -- [Scalar Value Types](#scalar-value-types) - - - - -
- -## proto/api/v1/mobile.proto - - - - - -### Animal -Animals - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| name | [string](#string) | | | -| in_danger | [bool](#bool) | | | -| description | [string](#string) | | | - - - - - - - - -### AnimalsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| location | [Location](#platform-api-v1-Location) | | | - - - - - - - - -### AnimalsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| animals | [Animal](#platform-api-v1-Animal) | repeated | | - - - - - - - - -### AreaRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| location | [Location](#platform-api-v1-Location) | | | - - - - - - - - -### AreaResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| name | [string](#string) | | | -| condition | [Condition](#platform-api-v1-Condition) | | | -| temperature | [float](#float) | | | -| distance | [double](#double) | | | - - - - - - - - -### Location -Location - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| longitude | [int32](#int32) | | | -| latitude | [int32](#int32) | | | -| name | [string](#string) | | | - - - - - - - - -### LocationRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ip | [string](#string) | | | - - - - - - - - -### LocationResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| location | [Location](#platform-api-v1-Location) | | | - - - - - - - - -### V1Response -BFF - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| location | [Location](#platform-api-v1-Location) | | | -| nearest_aquatic_location | [AreaResponse](#platform-api-v1-AreaResponse) | | | -| animals | [Animal](#platform-api-v1-Animal) | repeated | | - - - - - - - - - - -### Condition -Area - -| Name | Number | Description | -| ---- | ------ | ----------- | -| GOOD | 0 | | -| MODERATE | 1 | | -| CONTAMINATED | 2 | | -| UNKNOWN | 3 | | -| RADIATION | 4 | | -| DANGER | 5 | | -| PROTECTED | 6 | | - - - - - - - - - -### Bff -BFF service - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| GetV1 | [.google.protobuf.Empty](#google-protobuf-Empty) | [V1Response](#platform-api-v1-V1Response) | | - - - - -### Internal -Internal service - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| GetAnimals | [AnimalsRequest](#platform-api-v1-AnimalsRequest) | [AnimalsResponse](#platform-api-v1-AnimalsResponse) | | -| GetArea | [AreaRequest](#platform-api-v1-AreaRequest) | [AreaResponse](#platform-api-v1-AreaResponse) | | -| GetLocation | [LocationRequest](#platform-api-v1-LocationRequest) | [LocationResponse](#platform-api-v1-LocationResponse) | | - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | -| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | -| double | | double | double | float | float64 | double | float | Float | -| float | | float | float | float | float32 | float | float | Float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | -| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | - diff --git a/proto/greenspace/api/v1/README.md b/proto/greenspace/api/v1/README.md new file mode 100644 index 0000000..1dd8aea --- /dev/null +++ b/proto/greenspace/api/v1/README.md @@ -0,0 +1,207 @@ +# Documentation + + + +## Reference + +[hoguera/platform/proto/greenspace/api/v1/mobile.proto](#hoguera/platform/proto/greenspace/api/v1/mobile.proto) +