mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-15 08:41:16 -05:00
* add example generator infrastructure, with some examples for pkg/jmap and pkg/groupware, with more needing to be done * alter the apidoc Makefile to stop using go-swagger but, instead, use the openapi.yml file that must be dropped into that directory using groupware-apidocs (will improve the integration there later) * add Makefile target to generate examples * bump redocly from 2.4.0 to 2.14.5 * introduce Request.PathParam() and .PathParamDoc() to improve API documentation, as well as future-proofing * improve X-Request-ID and Trace-Id header handling in the middleware by logging it safely when an error occurs in the middleware
49 lines
1.8 KiB
Makefile
49 lines
1.8 KiB
Makefile
SHELL := bash
|
|
NAME := groupware
|
|
|
|
ifneq (, $(shell command -v go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
|
|
include ../../.bingo/Variables.mk
|
|
endif
|
|
|
|
include ../../.make/default.mk
|
|
include ../../.make/go.mk
|
|
include ../../.make/release.mk
|
|
include ../../.make/docs.mk
|
|
|
|
.PHONY: apidoc
|
|
apidoc: swagger.yml
|
|
|
|
.PHONY: tsnode
|
|
tsnode: node_modules
|
|
|
|
.PHONY: node_modules
|
|
node_modules:
|
|
pnpm install
|
|
|
|
.PHONY: swagger.yml
|
|
swagger.yml: apidoc.yml tsnode openapi.yml
|
|
#swagger generate spec --include='groupware' --include='jmap' --include='jscalendar' --include='jscontact' --scan-models --input=$< | NODE_OPTIONS='--no-warnings --loader ts-node/esm' pnpm exec ts-node apidoc-process.ts > $@
|
|
#NODE_OPTIONS='--no-warnings --loader ts-node/esm' pnpm exec ts-node apidoc-process.ts > $@ < openapi.yml
|
|
cp openapi.yml $@
|
|
|
|
APIDOC_PORT=9999
|
|
|
|
.PHONY: serve-apidoc
|
|
serve-apidoc: swagger.yml tsnode
|
|
swagger serve --no-open --port=$(APIDOC_PORT) --host=127.0.0.1 --flavor=redoc $<
|
|
|
|
api.html: swagger.yml favicon.png tsnode
|
|
pnpm exec redocly build-docs --output=$@.template --title="OpenCloud Groupware API" --theme.openapi.hideHostname=false --theme.openapi.hideTryItPanel=false --theme.openapi.pathInMiddlePanel=true $<
|
|
NODE_OPTIONS='--no-warnings --loader ts-node/esm' pnpm exec ts-node ./apidoc-postprocess-html.ts favicon.png < $@.template > $@
|
|
rm $@.template
|
|
|
|
.PHONY: apidoc-static
|
|
apidoc-static: api.html
|
|
|
|
.PHONY: examples
|
|
examples:
|
|
cd ../../pkg/jmap/ && go test -tags=groupware_examples . -v -count=1 -run Example
|
|
cd ../../pkg/jscontact/ && go test -tags=groupware_examples . -v -count=1 -run Example
|
|
cd ../../pkg/jscalendar/ && go test -tags=groupware_examples . -v -count=1 -run Example
|
|
cd ./pkg/groupware/ && go test -tags=groupware_examples . -v -count=1 -run Example
|