68dda8c048
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
1.2 KiB
1.2 KiB
id, title, description
| id | title | description |
|---|---|---|
| generate-client | Generate a client from your OpenAPI spec | Documentation on how to create a client for a given OpenAPI spec |
How to generate a client with repo-tools package schema openapi generate client?
Prerequisites
- Set your OpenAPI file's
info.titleto your pluginID like so,
info:
# your pluginId
title: catalog
- Find or create a new plugin to house your new generated client. Currently, we do not support generating an entirely new plugin and instead just generate client files.
Generating your client
- Run
yarn backstage-repo-tools package schema openapi generate --client-package <directory>. This will create a new folder in<directory>/src/schema/openapi/generatedto house the generated content. - You should not need to import anything from subfolders of the
src/schema/openapi/generatedparent folder, everything you should require will be accessible from thesrc/schema/openapi/generated/index.tsfile. Of note, DefaultApiClient- this is the client that you can use to access your specific spec.- Any request or response types - these will be available from the index and should match the names in your spec.