OpenAPI Generation in GitHub Actions

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.

  1. Run your test cases to generate AppMaps
  2. Use the openapi command to export the OpenAPI definitions

Run your test cases to generate AppMaps

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.

Use the openapi command to export the OpenAPI definitions

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.

Example:

- 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:


Was this page helpful? thumb_up Yes thumb_down No
Thank you for your feedback!