This is a simple tool to generate API documentation for RHACS. It uses the OpenAPI Generator to generate the documentation.
To generate the documentation:
- Open your
openshift-docsrepository and create a new branch:cd openshift-docs git checkout -b <branch-name>
- Pull the latest image:
docker pull quay.io/ganelson/rhacs-api-docs-gen
- Run the docker container to generate the documentation:
docker run --rm -it -v "$(pwd)":/openshift-docs quay.io/ganelson/rhacs-api-docs-gen generate - Enter the version of RHACS you want to generate the documentation for:
Please provide the version number of the RHACS release (e.g., 4.6.0): <version>
rhacs-api-docs-gengenerates the documentation in therest_apidirectory and updates the_topic_map.ymlfile with the new API documentation.- Run the portal build verification script to ensure everything is correct:
./scripts/prow-smoke-test.sh -a openshift-acs "Red Hat Advanced Cluster Security" "<version>"
You must manually check and update the _topic_map.yml file with yamllint before committing the changes. The usual errors are:
- Missing or additional
---at the beginning of the API reference section. - No newline at the end of the file.
The error might be something like Unescaped '<' not allowed in attributes values, line 70412, column 76 (master.xml, line 70412).
To debug this type of error, inspect the generated master.xml file at drupal-build/openshift-acs/rest_api/build/master.xml.
- Read the specific line.
sed '70412!d' drupal-build/openshift-acs/rest_api/build/master.xml <entry align="left" valign="top"><simpara><link linkend="Next_available_tag<emphasis>10__v1_externalbackups_externalBackup.id_patch">Next_available_tag</emphasis>10</link></simpara></entry> - The existence of
Next_available_tag<emphasis>10is causing this issue. Search forNext_available_tag__10in your editor (VS Code) for the matching entry. - Fix it by removing all underscores and capitalizing the first character. In this case, change the matching line
| <<Next_available_tag__10_{context}, Next_available_tag__10>>to| <<NextAvailableTag10_{context}, NextAvailableTag10>>. - You can also copy the script below and run it locally to fix the these types of tags.
#!/bin/bash DIRECTORY="rest_api" if [ ! -d "$DIRECTORY" ]; then echo "Directory $DIRECTORY does not exist." exit 1 fi find "$DIRECTORY" -type f -name "*.adoc" -exec sed -i.bak -E 's/Next_available_tag__([0-9]+)/NextAvailableTag\1/g; s/Next_Tag__([0-9]+)/NextTag\1/g' {} + find "$DIRECTORY" -type f -name "*.adoc" | while read -r file; do if [ -f "$file.bak" ]; then CHANGES=$(diff -u "$file.bak" "$file" | grep -E '^\+' | grep -vE '^\+\+\+' | wc -l) if [ "$CHANGES" -gt 0 ]; then echo "Fixed incorrect tags in: $file, Change count: $CHANGES" fi rm "$file.bak" fi done
You must run the Prow smoke test script and check for Pantheon build errors.
- Run the smoke test command with the
-aflag to check for Pantheon build errors:./scripts/prow-smoke-test.sh -a openshift-acs "Red Hat Advanced Cluster Security" "4.6"
- The errors will be displayed in the console output.
- For example, if the error is
Unknown ID or title "AuthServiceUpdateAuthMachineToMachineConfigBody_config__v1_auth_m2m_config.id_put", used as an internal cross reference. You must search for the ID before the double__. That is search forAuthServiceUpdateAuthMachineToMachineConfigBody_config. The error in this instance is that there is not ID matching the search term. In the same file you should then search for the matching ID. In this instance it isAuthServiceUpdateAuthMachineToMachineConfigBodyConfig. You should then replace the incorrect ID with the correct ID in the adoc file.
Parts of the scripts were generated using AI tools.

