The AppMap CLI provides an
openapi subcommand to automatically generate an OpenAPI v3 compatible spec file.
This guide describes how to use the
openapi command using GitHub Actions
Make sure you have AppMap configured with your project in your GitHub Action. Refer to the test case recording documentation to learn how to add AppMap to record your test cases.
Modify your GitHub Action that runs test cases to generate AppMaps. The specifics of this depend on your language and framework. See the recording test cases reference for details.
Within your GitHub Action - add in a step to run the AppMap CLI
openapi command. The simplest way to run the AppMap CLI is by using the Node
npx command. Ensure that your GitHub Action has a supported version of Node.js to run this command. Refer to the Node.js requirements for install for the supported Node.js versions.
With a supported Node.js version in your build project, add a line to generate the OpenAPI definitions.
Note This needs to happen in the step AFTER your tests finish in your build task because it needs the AppMaps generated and available within the build.
- name: Run tests run: bundle exec rake test - name: AppMap Generate OpenAPI Definitions run: npx @appland/appmap@latest openapi --output-file openapi.yml
Optional tasks after generating an OpenAPI definition: