mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
The bump job of release-all.yml (.tools/wekan13, run 93672173482) regenerates public/api/wekan.yml with openapi/generate_openapi.py and then renders it with @redocly/cli, which stopped the release with "Error: bad indentation of a mapping entry in public/api/wekan.yml (1232:2)". A @param whose description continues on the next JSDoc lines - models/exportCharts.js's chartKey, "one of dashboard, burndown, ... controlChart, ..." - was emitted under `description: |` with only its FIRST line indented; the continuation lines landed at column 1, which is no longer inside the block scalar, so the whole spec failed to parse. print_openapi_param now indents every line of the description. The same job warned "unknown type object / allowed values: string, number, boolean, integer, array, file" four times for the rules API's trigger/action params. OpenAPI 2.0 has no `object` for a path/query/form parameter; those are now emitted as `type: string` / `format: json` (the REST API takes them as JSON in a string), and `object` no longer warns. Reproduced locally (PyYAML: "expected <block end>, but found '<scalar>' ... line 1232, column 2"); after the fix the spec parses and `npx @redocly/cli build-docs` - the exact step that failed - renders it. tests/openapiParamMultiline.test.cjs pins the emitter and, where python3 with PyYAML is available (it is in CI), parses the regenerated spec. Thanks to xet7 !
OpenAPI tools and doc generation
Open API generation
This folder contains a script (generate_openapi.py) that extracts
the REST API of Wekan and exports it under the OpenAPI 2.0 specification
(Swagger 2.0).
dependencies
- python3
- esprima-python
calling the tool
python3 generate_openapi.py --release v7.92 > ../public/api/wekan.yml
Generating docs
Now that we have the OpenAPI, it's easy enough to convert the YAML file into some nice Markdown with shins and api2html, or even ReDoc:
api2html -c ../public/logo-header.png -o api.html ../public/wekan_api.yml
or
redoc-cli serve ../public/wekan_api.yml