2019-12-11 13:55:03 +00:00
|
|
|
SHELL=/usr/bin/env bash
|
|
|
|
|
2019-07-08 15:02:03 +00:00
|
|
|
all: build
|
2019-07-17 11:42:49 +00:00
|
|
|
.PHONY: all
|
2019-07-08 15:02:03 +00:00
|
|
|
|
2020-04-30 21:20:26 +00:00
|
|
|
unexport GOFLAGS
|
|
|
|
|
2021-07-29 08:29:22 +00:00
|
|
|
GOCC?=go
|
|
|
|
|
2021-07-28 17:12:23 +00:00
|
|
|
GOVERSION:=$(shell $(GOCC) version | tr ' ' '\n' | grep go1 | sed 's/^go//' | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}')
|
2022-10-18 15:41:28 +00:00
|
|
|
GOVERSIONMIN:=$(shell cat GO_VERSION_MIN | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}')
|
|
|
|
|
|
|
|
ifeq ($(shell expr $(GOVERSION) \< $(GOVERSIONMIN)), 1)
|
2020-11-19 02:11:35 +00:00
|
|
|
$(warning Your Golang version is go$(shell expr $(GOVERSION) / 1000000).$(shell expr $(GOVERSION) % 1000000 / 1000).$(shell expr $(GOVERSION) % 1000))
|
2022-10-18 15:41:28 +00:00
|
|
|
$(error Update Golang to version to at least $(shell cat GO_VERSION_MIN))
|
2019-10-22 13:07:15 +00:00
|
|
|
endif
|
2019-07-08 15:02:03 +00:00
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
# git modules that need to be loaded
|
|
|
|
MODULES:=
|
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
CLEAN:=
|
2019-12-02 14:26:39 +00:00
|
|
|
BINS:=
|
2020-04-30 21:20:26 +00:00
|
|
|
|
2020-06-01 18:43:51 +00:00
|
|
|
ldflags=-X=github.com/filecoin-project/lotus/build.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
|
2020-04-30 21:20:26 +00:00
|
|
|
ifneq ($(strip $(LDFLAGS)),)
|
2020-04-30 21:24:51 +00:00
|
|
|
ldflags+=-extldflags=$(LDFLAGS)
|
2020-04-30 21:20:26 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
GOFLAGS+=-ldflags="$(ldflags)"
|
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
## FFI
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
FFI_PATH:=extern/filecoin-ffi/
|
2020-03-24 18:19:41 +00:00
|
|
|
FFI_DEPS:=.install-filcrypto
|
2019-11-27 01:46:17 +00:00
|
|
|
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
|
2019-07-19 11:56:18 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
$(FFI_DEPS): build/.filecoin-install ;
|
2019-07-19 11:56:18 +00:00
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
build/.filecoin-install: $(FFI_PATH)
|
|
|
|
$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
|
2019-07-17 11:42:49 +00:00
|
|
|
@touch $@
|
|
|
|
|
2019-11-27 01:46:17 +00:00
|
|
|
MODULES+=$(FFI_PATH)
|
|
|
|
BUILD_DEPS+=build/.filecoin-install
|
|
|
|
CLEAN+=build/.filecoin-install
|
2019-07-26 22:25:53 +00:00
|
|
|
|
2021-02-15 12:30:56 +00:00
|
|
|
ffi-version-check:
|
2021-06-18 13:49:59 +00:00
|
|
|
@[[ "$$(awk '/const Version/{print $$5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo "FFI version mismatch, update submodules"; exit 1)
|
2021-02-15 12:30:56 +00:00
|
|
|
BUILD_DEPS+=ffi-version-check
|
|
|
|
|
|
|
|
.PHONY: ffi-version-check
|
|
|
|
|
2021-02-15 18:54:25 +00:00
|
|
|
$(MODULES): build/.update-modules ;
|
2019-09-04 09:49:22 +00:00
|
|
|
# dummy file that marks the last time modules were updated
|
2021-02-15 18:54:25 +00:00
|
|
|
build/.update-modules:
|
2019-09-04 09:49:22 +00:00
|
|
|
git submodule update --init --recursive
|
|
|
|
touch $@
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-09-04 09:49:22 +00:00
|
|
|
# end git modules
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-11-30 08:21:01 +00:00
|
|
|
## MAIN BINARIES
|
2019-08-28 16:14:32 +00:00
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
CLEAN+=build/.update-modules
|
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
deps: $(BUILD_DEPS)
|
|
|
|
.PHONY: deps
|
2019-07-08 11:00:52 +00:00
|
|
|
|
2024-06-21 18:48:22 +00:00
|
|
|
build-devnets: build lotus-seed lotus-shed
|
2021-03-18 15:11:43 +00:00
|
|
|
.PHONY: build-devnets
|
|
|
|
|
2019-12-11 22:00:39 +00:00
|
|
|
debug: GOFLAGS+=-tags=debug
|
2021-03-18 15:11:43 +00:00
|
|
|
debug: build-devnets
|
2019-11-23 19:13:07 +00:00
|
|
|
|
2020-04-17 15:58:20 +00:00
|
|
|
2k: GOFLAGS+=-tags=2k
|
2021-03-18 15:11:43 +00:00
|
|
|
2k: build-devnets
|
2020-04-17 15:58:20 +00:00
|
|
|
|
2021-01-05 05:32:15 +00:00
|
|
|
calibnet: GOFLAGS+=-tags=calibnet
|
2021-03-18 15:11:43 +00:00
|
|
|
calibnet: build-devnets
|
2021-01-05 05:32:15 +00:00
|
|
|
|
2021-01-28 18:15:04 +00:00
|
|
|
butterflynet: GOFLAGS+=-tags=butterflynet
|
2021-03-18 15:11:43 +00:00
|
|
|
butterflynet: build-devnets
|
2021-01-28 18:15:04 +00:00
|
|
|
|
2021-06-02 18:49:10 +00:00
|
|
|
interopnet: GOFLAGS+=-tags=interopnet
|
|
|
|
interopnet: build-devnets
|
|
|
|
|
2019-10-04 20:10:49 +00:00
|
|
|
lotus: $(BUILD_DEPS)
|
|
|
|
rm -f lotus
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus ./cmd/lotus
|
2019-10-04 20:10:49 +00:00
|
|
|
|
|
|
|
.PHONY: lotus
|
2019-11-30 08:21:01 +00:00
|
|
|
BINS+=lotus
|
2019-10-04 20:10:49 +00:00
|
|
|
|
2020-07-08 10:38:59 +00:00
|
|
|
lotus-miner: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-miner
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-miner ./cmd/lotus-miner
|
2020-07-08 10:38:59 +00:00
|
|
|
.PHONY: lotus-miner
|
|
|
|
BINS+=lotus-miner
|
2019-10-04 20:10:49 +00:00
|
|
|
|
2020-07-09 03:04:45 +00:00
|
|
|
lotus-worker: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-worker
|
2022-03-24 22:37:01 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-worker ./cmd/lotus-worker
|
2020-07-09 03:04:45 +00:00
|
|
|
.PHONY: lotus-worker
|
|
|
|
BINS+=lotus-worker
|
2019-10-04 20:10:49 +00:00
|
|
|
|
2019-12-10 10:15:50 +00:00
|
|
|
lotus-shed: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-shed
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-shed ./cmd/lotus-shed
|
2020-02-25 07:48:41 +00:00
|
|
|
.PHONY: lotus-shed
|
|
|
|
BINS+=lotus-shed
|
2019-12-10 10:15:50 +00:00
|
|
|
|
2020-09-15 09:45:03 +00:00
|
|
|
lotus-gateway: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-gateway
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-gateway ./cmd/lotus-gateway
|
2020-09-15 09:45:03 +00:00
|
|
|
.PHONY: lotus-gateway
|
|
|
|
BINS+=lotus-gateway
|
|
|
|
|
2024-06-21 18:48:22 +00:00
|
|
|
build: lotus lotus-miner lotus-worker
|
2019-12-11 14:48:54 +00:00
|
|
|
@[[ $$(type -P "lotus") ]] && echo "Caution: you have \
|
2019-12-11 14:53:57 +00:00
|
|
|
an existing lotus binary in your PATH. This may cause problems if you don't run 'sudo make install'" || true
|
2019-12-11 13:55:03 +00:00
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
.PHONY: build
|
2019-07-08 11:00:52 +00:00
|
|
|
|
2024-06-21 18:48:22 +00:00
|
|
|
install: install-daemon install-miner install-worker
|
2020-08-05 15:26:40 +00:00
|
|
|
|
|
|
|
install-daemon:
|
2019-10-15 02:35:22 +00:00
|
|
|
install -C ./lotus /usr/local/bin/lotus
|
2019-10-03 18:07:49 +00:00
|
|
|
|
2020-08-07 03:09:26 +00:00
|
|
|
install-miner:
|
|
|
|
install -C ./lotus-miner /usr/local/bin/lotus-miner
|
2020-05-27 21:12:45 +00:00
|
|
|
|
2020-08-07 03:09:26 +00:00
|
|
|
install-worker:
|
|
|
|
install -C ./lotus-worker /usr/local/bin/lotus-worker
|
2020-05-27 21:12:45 +00:00
|
|
|
|
2020-12-11 12:10:40 +00:00
|
|
|
install-app:
|
|
|
|
install -C ./$(APP) /usr/local/bin/$(APP)
|
|
|
|
|
2022-06-06 16:52:13 +00:00
|
|
|
uninstall: uninstall-daemon uninstall-miner uninstall-worker
|
|
|
|
.PHONY: uninstall
|
|
|
|
|
|
|
|
uninstall-daemon:
|
|
|
|
rm -f /usr/local/bin/lotus
|
|
|
|
|
|
|
|
uninstall-miner:
|
|
|
|
rm -f /usr/local/bin/lotus-miner
|
|
|
|
|
|
|
|
uninstall-worker:
|
|
|
|
rm -f /usr/local/bin/lotus-worker
|
|
|
|
|
2019-11-30 08:21:01 +00:00
|
|
|
# TOOLS
|
|
|
|
|
|
|
|
lotus-seed: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-seed
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-seed ./cmd/lotus-seed
|
2019-11-30 08:21:01 +00:00
|
|
|
|
|
|
|
.PHONY: lotus-seed
|
|
|
|
BINS+=lotus-seed
|
|
|
|
|
2019-08-29 22:59:12 +00:00
|
|
|
benchmarks:
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) run github.com/whyrusleeping/bencher ./... > bench.json
|
2019-08-29 23:25:23 +00:00
|
|
|
@echo Submitting results
|
|
|
|
@curl -X POST 'http://benchmark.kittyhawk.wtf/benchmark' -d '@bench.json' -u "${benchmark_http_cred}"
|
2019-08-29 23:18:26 +00:00
|
|
|
.PHONY: benchmarks
|
2019-08-29 22:59:12 +00:00
|
|
|
|
2020-07-08 10:38:59 +00:00
|
|
|
lotus-fountain:
|
|
|
|
rm -f lotus-fountain
|
2022-08-05 02:47:06 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-fountain ./cmd/lotus-fountain
|
|
|
|
$(GOCC) run github.com/GeertJohan/go.rice/rice append --exec lotus-fountain -i ./cmd/lotus-fountain -i ./build
|
2020-07-08 10:38:59 +00:00
|
|
|
.PHONY: lotus-fountain
|
|
|
|
BINS+=lotus-fountain
|
|
|
|
|
|
|
|
lotus-bench:
|
|
|
|
rm -f lotus-bench
|
2022-05-30 11:29:37 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-bench ./cmd/lotus-bench
|
2020-07-08 10:38:59 +00:00
|
|
|
.PHONY: lotus-bench
|
|
|
|
BINS+=lotus-bench
|
|
|
|
|
|
|
|
lotus-stats:
|
|
|
|
rm -f lotus-stats
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-stats ./cmd/lotus-stats
|
2020-07-08 10:38:59 +00:00
|
|
|
.PHONY: lotus-stats
|
|
|
|
BINS+=lotus-stats
|
|
|
|
|
2020-08-07 07:12:29 +00:00
|
|
|
lotus-pcr:
|
|
|
|
rm -f lotus-pcr
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-pcr ./cmd/lotus-pcr
|
2020-08-07 07:12:29 +00:00
|
|
|
.PHONY: lotus-pcr
|
|
|
|
BINS+=lotus-pcr
|
|
|
|
|
2020-07-08 10:38:59 +00:00
|
|
|
lotus-health:
|
2020-01-07 14:03:58 +00:00
|
|
|
rm -f lotus-health
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build -o lotus-health ./cmd/lotus-health
|
2020-07-08 10:38:59 +00:00
|
|
|
.PHONY: lotus-health
|
|
|
|
BINS+=lotus-health
|
2020-01-14 17:14:59 +00:00
|
|
|
|
2023-09-21 15:37:02 +00:00
|
|
|
lotus-wallet: $(BUILD_DEPS)
|
2020-10-08 23:37:17 +00:00
|
|
|
rm -f lotus-wallet
|
2022-04-28 08:10:29 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-wallet ./cmd/lotus-wallet
|
2020-10-08 23:37:17 +00:00
|
|
|
.PHONY: lotus-wallet
|
|
|
|
BINS+=lotus-wallet
|
|
|
|
|
2020-12-04 10:39:35 +00:00
|
|
|
lotus-keygen:
|
|
|
|
rm -f lotus-keygen
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build -o lotus-keygen ./cmd/lotus-keygen
|
2020-12-04 10:39:35 +00:00
|
|
|
.PHONY: lotus-keygen
|
|
|
|
BINS+=lotus-keygen
|
|
|
|
|
2020-07-10 12:18:09 +00:00
|
|
|
testground:
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build -tags testground -o /dev/null ./cmd/lotus
|
2020-07-10 12:18:09 +00:00
|
|
|
.PHONY: testground
|
|
|
|
BINS+=testground
|
2020-06-30 13:46:28 +00:00
|
|
|
|
2021-04-05 18:12:47 +00:00
|
|
|
|
|
|
|
tvx:
|
|
|
|
rm -f tvx
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build -o tvx ./cmd/tvx
|
2021-04-05 18:12:47 +00:00
|
|
|
.PHONY: tvx
|
|
|
|
BINS+=tvx
|
|
|
|
|
2021-06-21 16:12:00 +00:00
|
|
|
lotus-sim: $(BUILD_DEPS)
|
|
|
|
rm -f lotus-sim
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o lotus-sim ./cmd/lotus-sim
|
2021-06-21 16:12:00 +00:00
|
|
|
.PHONY: lotus-sim
|
|
|
|
BINS+=lotus-sim
|
|
|
|
|
2020-08-05 15:26:40 +00:00
|
|
|
# SYSTEMD
|
|
|
|
|
|
|
|
install-daemon-service: install-daemon
|
|
|
|
mkdir -p /etc/systemd/system
|
|
|
|
mkdir -p /var/log/lotus
|
|
|
|
install -C -m 0644 ./scripts/lotus-daemon.service /etc/systemd/system/lotus-daemon.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
@echo
|
2024-02-22 18:33:06 +00:00
|
|
|
@echo "lotus-daemon service installed."
|
|
|
|
@echo "To start the service, run: 'sudo systemctl start lotus-daemon'"
|
|
|
|
@echo "To enable the service on startup, run: 'sudo systemctl enable lotus-daemon'"
|
2020-08-05 15:26:40 +00:00
|
|
|
|
|
|
|
install-miner-service: install-miner install-daemon-service
|
|
|
|
mkdir -p /etc/systemd/system
|
|
|
|
mkdir -p /var/log/lotus
|
|
|
|
install -C -m 0644 ./scripts/lotus-miner.service /etc/systemd/system/lotus-miner.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
@echo
|
2024-02-22 18:33:06 +00:00
|
|
|
@echo "lotus-miner service installed."
|
|
|
|
@echo "To start the service, run: 'sudo systemctl start lotus-miner'"
|
|
|
|
@echo "To enable the service on startup, run: 'sudo systemctl enable lotus-miner'"
|
2020-08-05 15:26:40 +00:00
|
|
|
|
|
|
|
install-main-services: install-miner-service
|
|
|
|
|
2021-07-28 15:53:33 +00:00
|
|
|
install-all-services: install-main-services
|
2020-08-05 15:26:40 +00:00
|
|
|
|
|
|
|
install-services: install-main-services
|
|
|
|
|
2021-07-28 15:53:33 +00:00
|
|
|
clean-daemon-service: clean-miner-service
|
2020-08-05 15:26:40 +00:00
|
|
|
-systemctl stop lotus-daemon
|
|
|
|
-systemctl disable lotus-daemon
|
|
|
|
rm -f /etc/systemd/system/lotus-daemon.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
2020-08-07 03:09:26 +00:00
|
|
|
clean-miner-service:
|
2020-08-05 15:26:40 +00:00
|
|
|
-systemctl stop lotus-miner
|
|
|
|
-systemctl disable lotus-miner
|
|
|
|
rm -f /etc/systemd/system/lotus-miner.service
|
|
|
|
systemctl daemon-reload
|
2020-08-07 03:09:26 +00:00
|
|
|
|
2020-08-05 15:26:40 +00:00
|
|
|
clean-main-services: clean-daemon-service
|
2020-08-07 03:09:26 +00:00
|
|
|
|
|
|
|
clean-all-services: clean-main-services
|
2020-08-05 15:26:40 +00:00
|
|
|
|
|
|
|
clean-services: clean-all-services
|
|
|
|
|
2019-11-30 08:21:01 +00:00
|
|
|
# MISC
|
|
|
|
|
|
|
|
buildall: $(BINS)
|
2019-10-12 00:13:16 +00:00
|
|
|
|
2020-04-03 02:03:53 +00:00
|
|
|
install-completions:
|
|
|
|
mkdir -p /usr/share/bash-completion/completions /usr/local/share/zsh/site-functions/
|
|
|
|
install -C ./scripts/bash-completion/lotus /usr/share/bash-completion/completions/lotus
|
|
|
|
install -C ./scripts/zsh-completion/lotus /usr/local/share/zsh/site-functions/_lotus
|
|
|
|
|
2024-02-22 18:34:49 +00:00
|
|
|
unittests:
|
|
|
|
@$(GOCC) test $(shell go list ./... | grep -v /lotus/itests)
|
|
|
|
.PHONY: unittests
|
|
|
|
|
2019-07-19 11:56:18 +00:00
|
|
|
clean:
|
2019-11-30 08:21:01 +00:00
|
|
|
rm -rf $(CLEAN) $(BINS)
|
2019-11-27 01:46:17 +00:00
|
|
|
-$(MAKE) -C $(FFI_PATH) clean
|
2019-07-19 11:56:18 +00:00
|
|
|
.PHONY: clean
|
|
|
|
|
2019-07-17 11:42:49 +00:00
|
|
|
dist-clean:
|
|
|
|
git clean -xdff
|
|
|
|
git submodule deinit --all -f
|
|
|
|
.PHONY: dist-clean
|
2019-07-22 22:25:35 +00:00
|
|
|
|
2021-03-25 14:19:22 +00:00
|
|
|
type-gen: api-gen
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) run ./gen/main.go
|
|
|
|
$(GOCC) generate -x ./...
|
2021-03-23 16:33:20 +00:00
|
|
|
goimports -w api/
|
2019-07-22 22:25:35 +00:00
|
|
|
|
2022-08-02 21:27:28 +00:00
|
|
|
actors-code-gen:
|
2021-10-18 15:33:28 +00:00
|
|
|
$(GOCC) run ./gen/inline-gen . gen/inlinegen-data.json
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) run ./chain/actors/agen
|
|
|
|
$(GOCC) fmt ./...
|
2021-04-30 15:51:24 +00:00
|
|
|
|
2024-05-16 11:31:08 +00:00
|
|
|
actors-gen: actors-code-gen
|
2024-03-14 21:03:42 +00:00
|
|
|
$(GOCC) run ./scripts/fiximports
|
2022-08-02 21:27:28 +00:00
|
|
|
.PHONY: actors-gen
|
|
|
|
|
feat: refactor: actor bundling system (#8838)
1. Include the builtin-actors in the lotus source tree.
2. Embed the bundle on build instead of downloading at runtime.
3. Avoid reading the bundle whenever possible by including bundle
metadata (the bundle CID, the actor CIDs, etc.).
4. Remove everything related to dependency injection.
1. We're no longer downloading the bundle, so doing anything ahead
of time doesn't really help.
2. We register the manifests on init because, unfortunately, they're
global.
3. We explicitly load the current actors bundle in the genesis
state-tree method.
4. For testing, we just change the in-use bundle with a bit of a
hack. It's not great, but using dependency injection doesn't make
any sense either because, again, the manifest information is
global.
5. Remove the bundle.toml file. Bundles may be overridden by
specifying an override path in the parameters file, or an
environment variable.
fixes #8701
2022-06-13 17:15:00 +00:00
|
|
|
bundle-gen:
|
2023-02-16 21:01:45 +00:00
|
|
|
$(GOCC) run ./gen/bundle $(VERSION) $(RELEASE) $(RELEASE_OVERRIDES)
|
feat: refactor: actor bundling system (#8838)
1. Include the builtin-actors in the lotus source tree.
2. Embed the bundle on build instead of downloading at runtime.
3. Avoid reading the bundle whenever possible by including bundle
metadata (the bundle CID, the actor CIDs, etc.).
4. Remove everything related to dependency injection.
1. We're no longer downloading the bundle, so doing anything ahead
of time doesn't really help.
2. We register the manifests on init because, unfortunately, they're
global.
3. We explicitly load the current actors bundle in the genesis
state-tree method.
4. For testing, we just change the in-use bundle with a bit of a
hack. It's not great, but using dependency injection doesn't make
any sense either because, again, the manifest information is
global.
5. Remove the bundle.toml file. Bundles may be overridden by
specifying an override path in the parameters file, or an
environment variable.
fixes #8701
2022-06-13 17:15:00 +00:00
|
|
|
$(GOCC) fmt ./build/...
|
|
|
|
.PHONY: bundle-gen
|
|
|
|
|
|
|
|
|
2021-03-23 12:42:56 +00:00
|
|
|
api-gen:
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) run ./gen/api
|
2021-03-25 14:09:50 +00:00
|
|
|
goimports -w api
|
|
|
|
goimports -w api
|
2021-03-23 12:42:56 +00:00
|
|
|
.PHONY: api-gen
|
2020-04-24 00:04:12 +00:00
|
|
|
|
2021-07-23 11:55:50 +00:00
|
|
|
cfgdoc-gen:
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) run ./node/config/cfgdocgen > ./node/config/doc_gen.go
|
2021-07-23 11:55:50 +00:00
|
|
|
|
2021-05-07 02:37:06 +00:00
|
|
|
appimage: lotus
|
2021-05-07 02:48:56 +00:00
|
|
|
rm -rf appimage-builder-cache || true
|
|
|
|
rm AppDir/io.filecoin.lotus.desktop || true
|
|
|
|
rm AppDir/icon.svg || true
|
|
|
|
rm Appdir/AppRun || true
|
2021-05-07 02:37:06 +00:00
|
|
|
mkdir -p AppDir/usr/bin
|
|
|
|
cp ./lotus AppDir/usr/bin/
|
|
|
|
appimage-builder
|
|
|
|
|
2022-06-14 15:03:12 +00:00
|
|
|
docsgen: docsgen-md docsgen-openrpc fiximports
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
|
2021-04-30 15:51:24 +00:00
|
|
|
docsgen-md-bin: api-gen actors-gen
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o docgen-md ./api/docgen/cmd
|
2021-04-30 15:51:24 +00:00
|
|
|
docsgen-openrpc-bin: api-gen actors-gen
|
2021-07-28 15:29:17 +00:00
|
|
|
$(GOCC) build $(GOFLAGS) -o docgen-openrpc ./api/docgen-openrpc/cmd
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
|
2024-06-21 18:48:22 +00:00
|
|
|
docsgen-md: docsgen-md-full docsgen-md-storage docsgen-md-worker
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
|
|
|
|
docsgen-md-full: docsgen-md-bin
|
2021-03-23 16:20:56 +00:00
|
|
|
./docgen-md "api/api_full.go" "FullNode" "api" "./api" > documentation/en/api-v1-unstable-methods.md
|
|
|
|
./docgen-md "api/v0api/full.go" "FullNode" "v0api" "./api/v0api" > documentation/en/api-v0-methods.md
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
docsgen-md-storage: docsgen-md-bin
|
2021-03-23 16:20:56 +00:00
|
|
|
./docgen-md "api/api_storage.go" "StorageMiner" "api" "./api" > documentation/en/api-v0-methods-miner.md
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
docsgen-md-worker: docsgen-md-bin
|
2021-03-23 16:20:56 +00:00
|
|
|
./docgen-md "api/api_worker.go" "Worker" "api" "./api" > documentation/en/api-v0-methods-worker.md
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
|
2022-05-27 11:35:23 +00:00
|
|
|
docsgen-openrpc: docsgen-openrpc-full docsgen-openrpc-storage docsgen-openrpc-worker docsgen-openrpc-gateway
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
|
|
|
|
docsgen-openrpc-full: docsgen-openrpc-bin
|
2024-02-14 21:52:26 +00:00
|
|
|
./docgen-openrpc "api/api_full.go" "FullNode" "api" "./api" > build/openrpc/full.json
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
docsgen-openrpc-storage: docsgen-openrpc-bin
|
2024-02-14 21:52:26 +00:00
|
|
|
./docgen-openrpc "api/api_storage.go" "StorageMiner" "api" "./api" > build/openrpc/miner.json
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
docsgen-openrpc-worker: docsgen-openrpc-bin
|
2024-02-14 21:52:26 +00:00
|
|
|
./docgen-openrpc "api/api_worker.go" "Worker" "api" "./api" > build/openrpc/worker.json
|
2022-05-27 11:35:23 +00:00
|
|
|
docsgen-openrpc-gateway: docsgen-openrpc-bin
|
2024-02-14 21:52:26 +00:00
|
|
|
./docgen-openrpc "api/api_gateway.go" "Gateway" "api" "./api" > build/openrpc/gateway.json
|
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method
This implement the basic functionality for the method
over HTTP RPC.
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init example with go-openrpc-reflect lib
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* main: make variable name human-friendly
Signed-off-by: meows <b5c6@protonmail.com>
* main,go.mod,go.sum: init impl of go-openrp-reflect printing document
Signed-off-by: meows <b5c6@protonmail.com>
Conflicts:
go.mod
go.sum
* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.
Signed-off-by: meows <b5c6@protonmail.com>
* main,openrpc,main: refactor openrpc supporting code to own package
This eliminates code duplication.
Signed-off-by: meows <b5c6@protonmail.com>
* main: add rpc.Discover to openrpc document
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: fix rpc.discover method name casing
Also fixes casing stuff for the rest of Filecoin.
methods.
Signed-off-by: meows <b5c6@protonmail.com>
* Revert "main: add rpc.Discover to openrpc document"
This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.
* main: fix document creation method name
This fixes an issue caused with the latest reverting
commit.
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff
Signed-off-by: meows <b5c6@protonmail.com>
Makefile: fix docgen refactoring for makefile use of command
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: add schema.examples to app reflector
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init method pairing examples
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions
Signed-off-by: meows <b5c6@protonmail.com>
* openrpc: init SchemaType mapper function
This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.
This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.
Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect
This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.
etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'
This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: add 'miner' arg to openrpc gen cmd
This allows the command to EITHER
generate the doc for Full or Miner APIs.
See comment for usage.
Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen: add missing examples for Miner API
Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.
This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.
Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs
These will be used as static documents
provided by the rpc.discover method.
Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: init go-rice openrpc static assets
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: remove rpc.discover implementation from runtime plugin
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.
Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs
Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main: use rpc server method aliasing for rpc.discover
This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.
This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).
In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.
Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,build,common: rpc.discover: return json object instead of string
Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.
Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile: merge resolve: docsgen command path
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures
Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: 'get get' auto-bumps version
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation
This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.
The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).
Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc
Renames the package as well.
This is intended to parallel the
existing docgen package and command
namespacing.
Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api,apistruct,docgen,build,build/openrpc: use typed Discover response
Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.
This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.
Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs
Methods return static compiled assets respective
to the APIs.
Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info
This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).
Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* main,docgen_openrpc,main,build: fix lint issues
Fixes goimports, staticcheck, golint issues.
Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: fix: don't use an underscore in package name (golint)
Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: fix: mod-tidy-check (run 'go mod tidy')
Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest
This version includes the necessary RPCServer.AliasMethod
method.
Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* Makefile,main,build,build/openrpc: init gzipped openrpc static docs
Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: refactor gzip reading
Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: add basic test for openrpc doc from static assets
Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build: handle reader Close error
This keeps the errcheck linter happy.
Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.sum: run 'go mod tidy'
Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: go mod tidy
Tidying up after resolving the merge conflicts
with master at go.mod
Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest
This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.
Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples
Removing method example pairings since they were
redundant to schema examples and were not
implemented well.
Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.
Luckily these values aren't heavily used by the
method logic.
Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* docgenopenrpc: use generic number jsonschema for number types
Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.
Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.
Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts
Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'
Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/apistruct,node/impl: (lint) gofmt
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: maybe fix parse error: open ./api: no such file or directory
Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'
Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api/docgen: return if AST comment/groupdoc parsing encounters any error
This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218
where the environment makes file lookups hard or
impossible.
Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>
* api: Don't depend on build/
* make: support parallel docsgen
* openrpc gen: Use simple build version
* methodgen
* goimports
Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 18:22:46 +00:00
|
|
|
|
|
|
|
.PHONY: docsgen docsgen-md-bin docsgen-openrpc-bin
|
2020-08-24 10:20:23 +00:00
|
|
|
|
2022-06-14 14:39:10 +00:00
|
|
|
fiximports:
|
2024-03-14 21:03:42 +00:00
|
|
|
$(GOCC) run ./scripts/fiximports
|
2022-06-14 14:39:10 +00:00
|
|
|
|
2024-05-16 11:31:08 +00:00
|
|
|
gen: actors-code-gen type-gen cfgdoc-gen docsgen api-gen
|
2024-03-14 21:03:42 +00:00
|
|
|
$(GOCC) run ./scripts/fiximports
|
2023-06-03 17:59:50 +00:00
|
|
|
@echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO RUN 'make docsgen-cli'"
|
2021-03-23 12:42:56 +00:00
|
|
|
.PHONY: gen
|
|
|
|
|
2022-02-17 00:34:45 +00:00
|
|
|
jen: gen
|
|
|
|
|
2024-06-21 18:48:22 +00:00
|
|
|
snap: lotus lotus-miner lotus-worker
|
2021-05-06 22:36:11 +00:00
|
|
|
snapcraft
|
|
|
|
# snapcraft upload ./lotus_*.snap
|
|
|
|
|
2021-04-29 18:01:23 +00:00
|
|
|
# separate from gen because it needs binaries
|
2024-06-21 18:48:22 +00:00
|
|
|
docsgen-cli: lotus lotus-miner lotus-worker
|
2022-12-02 17:41:22 +00:00
|
|
|
python3 ./scripts/generate-lotus-cli.py
|
2021-09-30 16:23:53 +00:00
|
|
|
./lotus config default > documentation/en/default-lotus-config.toml
|
|
|
|
./lotus-miner config default > documentation/en/default-lotus-miner-config.toml
|
2021-04-29 18:01:23 +00:00
|
|
|
.PHONY: docsgen-cli
|
|
|
|
|
2019-07-22 22:25:35 +00:00
|
|
|
print-%:
|
|
|
|
@echo $*=$($*)
|
2021-06-22 20:25:36 +00:00
|
|
|
|