Welcome to the common package for bitbucket-cloud plugins!
This common package provides a reusable API client for the Bitbucket Cloud API which can be reused in catalog-backend-module plugins, scaffolder modules, etc.
Using a shared client allows to control all traffic going from Backstage to the Bitbucket Cloud API compared to separate clients or inline API calls.
We may want to leverage this later to add rate limiting, etc.
This command will
- refresh the schema/OpenAPI Specification
- re-generate the models
- reduce the models to the minimal needed
This command will download the latest version of the Bitbucket Cloud OpenAPI Specification and apply some mutations to fix bugs or improve the schema for a better code generation output.
yarn refresh-schema
The models used are created based on the local OpenAPI Specification file using a code generator. Some post-cleanup is applied to improve the generated output.
The client itself using the models is not generated.
yarn generate-models
In order to keep the API surface minimal, this command helps to only keep the minimal part of the
generated models by considering all Models
module members directly or transitively used by the
client implementation.
yarn reduce-models
If you want to add a new method to the client implementation which may use a new endpoint or "new" models you can
- optionally refresh the schema to get the latest version
- and generate the models.
At this point, you have all models usable for adding a new method using any of them.
If you are ready with your addition to the client, you can reduce the models to the minimal needed.