Code generation
Generating client or server code from an API specification allows you to interact with your API more efficiently during development and testing. Blackbird uses OpenAPI Generator to generate client or server code for the API description. However, you can use any of the available client or server generators. For more information, see the OpenAPI Generators List.
Using a sample template to generate code
To generate code using a sample template:
Download the sample petstore.yaml file to use for testing.
Run the code generate command:
- Apply the variables prompted by the CLI. Provide the package version and package name.
When the API project is generated, it creates a new directory with all the necessary modules and Go files for the projects, including the Dockerfile you'll use to run and debug the code.
Using an existing API in Blackbird to generate code
To use an existing API in Blackbird to generate code, pass the name of the API as an argument:
to generate the server framework code for the API, or
to generate the API client code.