Support Notice
The generator currently only supports OpenAPI Specification (OAS) 3.0. If you
need to generate templates from OpenAPI 2.0 (Swagger) or OAS 3.1
specifications, please reach out to the Tracecat support team via our Discord
channel.
Overview
The generator creates a template action for each operation defined in an OpenAPI specification. Each generated action includes:- Appropriate input schemas based on API parameters
- HTTP request steps with proper configuration
- Documentation links from the OpenAPI spec
- Authentication configuration
Getting Started
To use the OpenAPI to Action Generator, you’ll need:- An OpenAPI 3.0 specification file (JSON or YAML format)
- Python 3.12 or later
- The Tracecat package installed
Basic Usage
Run the generator script with the following command:Configuration
For more advanced control over the generation process, you can provide a configuration file using the--config
parameter:
Configuration Options
The configuration file follows this structure:Configuration Details
Endpoints Filtering
Use theendpoints
section to control which API endpoints are processed:
include.like
: Glob patterns to include paths (e.g.,/users/*
)include.exact
: Exact paths to include (e.g.,/users/profile
)exclude.like
: Glob patterns to exclude paths (e.g.,/internal/*
)exclude.exact
: Exact paths to exclude (e.g.,/users/admin
)
Definition Overrides
Thedefinition_overrides
section allows you to customize the generated action definitions. The supported fields are:
display_group
: Sets the display group for the action (e.g., “PetStore”)namespace
: Sets the namespace for the action (e.g., “the.pet.store”)author
: Sets the author of the action (e.g., “OpenAPI Generator”)doc_url_prefix
: Sets a prefix for documentation URLs (e.g., “https://petstore.swagger.io/docs”)name
: Overrides the action name (e.g., “delete_pet”)title
: Overrides the action title (e.g., “Deletes a pet”)description
: Overrides the action description (e.g., “HTTP DELETE request to /pet/”)doc_url
: Overrides the documentation URL (e.g., “https://petstore.swagger.io/v2”)deprecated
: Sets a deprecation message or flag (e.g., “This action is deprecated.”)
Authentication
Theauth
section configures authentication for the generated actions:
secrets
: Defines required secrets with name and keysinjection
: Specifies how to inject authentication into requests via headers or query parametersexpects
: Defines expected input fields for authentication
Output Organization
Theuse_namespace_directories
option controls how the generated files are organized:
- When
true
(default): Creates subdirectories based on the action namespace (e.g.,api/pets/action.yml
) - When
false
: Places all actions directly in the output directory