ByteChef LogoByteChef

OpenAPI Specification

  1. Create OpenAPI Specification:

    • Inside your new package, create an openapi.yaml file.
    • Write the OpenAPI specification for your component to define its API structure and endpoints.
  2. Navigate to CLI Directory:

    • Change your working directory to the BYTECHEF_HOME/cli/cli-app folder.
  3. Generate Component:

    • Execute the following command to generate the NewComponent in the newcomponent directory:
      ./bytechef.sh component init --open-api-path ../../server/libs/modules/components/newcomponent/openapi.yaml --output-path ../../server/libs/modules/components --name newcomponent --version 1
    • This command initializes the component based on the OpenAPI specification, placing the generated files in the specified output path.
    • bytechef.sh is a thin wrapper around ./gradlew -p cli/cli-app run. Its working directory is cli/cli-app, which is why the paths above are relative to it, and it appends --internal-component true so the generated module is laid out as a component that ships with the platform.

component init accepts:

OptionMeaning
--name, -nComponent name (required). Lower-cased before use.
--output-path, -oDirectory the generated module is written to (required).
--open-api-pathPath or URL of the OpenAPI specification. Without it the command does nothing.
--version, -vComponent version. Defaults to 1.
--base-package-namePackage for the generated classes. Defaults to com.bytechef.component.
--internal-componentWhether the component ships with the platform. Defaults to false; bytechef.sh passes true.

If you would rather run the CLI as a standalone binary - for a component you keep outside this repository - build it once with ./gradlew :cli:cli-app:installDist and call cli/cli-app/build/install/bytechef/bin/bytechef. The binary runs from your current working directory, so paths behave as you expect, and it does not pass --internal-component.

How is this guide?

Last updated on

On this page