For server-side projects that utilise RAML or OpenAPI (OAS), use the tool
api-doc to generate API documentation from its API description files and schema and examples.
For use during FOLIO CI builds, refer to the GitHub Workflows configuration section below. Note that the project should also use “api-lint” which utilises the same configuration for the properties apiTypes, apiDirectories, etc.)
The Python script will search the configured directories to find relevant API description files, and will process each file to generate the API documentation representation.
-t,--types– The type of API description files to search for. Required. Space-separated list. One or more of:
-d,--directories– The list of directories to be searched. Required. Space-separated list.
-e,--excludes– List of additional sub-directories and/or files to be excluded (so that the tool will only discover top-level root API description files). Optional. Space-separated list. By default it excludes certain well-known directories (such as
raml-util). Use the option
--loglevel debugto report what is being excluded.
See help for the full list (including the default output directory):
python3 ../folio-tools/api-doc/api_doc.py --help
Example for RAML:
cd $GH_FOLIO/mod-courses python3 ../folio-tools/api-doc/api_doc.py \ -t RAML \ -d ramls
Example for OAS:
cd $GH_FOLIO/mod-eusage-reports python3 ../folio-tools/api-doc/api_doc.py \ -t OAS \ -d src/main/resources/openapi \ -e headers
Example for both RAML and OpenAPI (OAS), i.e. when preparing for transition:
cd $GH_FOLIO/mod-foo python3 ../folio-tools/api-doc/api_doc.py \ -t RAML OAS \ -d ramls src/main/resources/oas
All relevant back-end repositories are now configured to use GitHub Workflows for the API-related tasks.
.github/workflows directory and the “Actions” UI tab.
The configuration properties are further described as comments in each workflow file.
Note the workflows only operate when there is a file change commit in their API descriptions directory.
- mod-courses – RAML.
- mod-settings – OAS.
- mod-notes – OAS.
- mod-calendar – OAS. This one also needs to “exclude” some sub-directories.
Occasionally verify that your workflow files are up-to-date (e.g. for the versions of dependent “actions”). Compare with the default files at folio-org/.github/workflow-templates.