ByteChef LogoByteChef

Generate Component

Scaffold a new component from an OpenAPI specification using the ByteChef CLI.

In the following steps, we will learn how to generate a new component from an OpenAPI specification using the ByteChef CLI (cli/cli-app). The CLI reads your API's OpenAPI definition and scaffolds a full component module - actions, properties, and a connection - so you don't have to write them by hand.

OpenAPI, formerly known as Swagger, is a specification for building APIs that allows developers to define their API's structure in a standardized format. By using the CLI, you can streamline the process of creating components by automatically generating code based on your OpenAPI definitions.

Steps

Initial setup - create the component package and register it in the Gradle build.

OpenAPI specification - add your openapi.yaml and run the CLI component init command to generate the component.

Customize the component - set the icon and category, adjust the connection and actions, and enable dynamic options, dynamic properties, dynamic output, and AI Agent tools via OpenAPI extensions.

Create a trigger - triggers are not generated from OpenAPI, so add them manually and wire them into the generated handler.

The result is the same kind of component module you would author by hand; once it is on the classpath, it appears in the workflow editor's component panel alongside the built-in connectors.

Generating a component only scaffolds the code. For APIs with non-standard behavior, or for triggers, you will still edit the generated classes as described in Customize the component and Create a trigger. If you prefer to write everything yourself, see Build a component by hand instead.

How is this guide?

Last updated on

On this page