Files
opencloud/services/groupware/Makefile
Pascal Bleser 62cace14fe docs(groupware): OpenAPI improvements
* refactor some pkg/jmap and groupware methods to make more sense from
   an API point-of-view

 * add path parameter documentation, but automate it by injecting their
   definition into the OpenAPI YAML tree that is extracted from the
   source code using go-swagger as it is too cumbersome, repetitive and
   error-prine to document them in the source code; wrote a TypeScript
   file apidoc-process.ts to do so

 * add generating an offline HTML file for the OpenAPI documentation
   using redocly, and injecting a favicon into the resulting HTML; wrote
   a TypeScript file apidoc-postprocess-html.ts to do so
2025-12-09 09:15:37 +01:00

40 lines
1.2 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
swagger generate spec --include='groupware' --include='jmap' --scan-models --input=$< | NODE_OPTIONS='--no-warnings' pnpm exec ts-node apidoc-process.ts > $@
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' pnpm exec ts-node ./apidoc-postprocess-html.ts favicon.png < $@.template > $@
rm $@.template
.PHONY: apidoc-static
apidoc-static: api.html