Generate the required files to deploy your service to an APIM instance. Just create the OpenApi doc and the CLI will take care of the rest.
First of all, make sure you have node v20
or higher installed. Then install the CLI and run the initialise command with:
npm i @go1/apim-cli -g
@go1/apim-cli init
You can alternatively use npx to install and initialise together
npx @go1/apim-cli init
This will kick off a wizard asking a few configuration questions including where to find the openapi.yml file. Afer the wizard has successfully finished, you should see a new folder called apim
with all the required files for your service inside.
- /apim
- openapi.yml
- config.yml
- auth.policy.xml
- /policies
- endpoint_1.xml
- endpoint_...xml
You're ready to push those files with your next commit and let the CI/CD pipeline handle the rest for you.
You can find more information about APIM here [Add link here]
CLI command for creating a new apim directory
@go1/apim-cli init [OPTION]
Option | Description | Type | Default | Required? |
---|---|---|---|---|
openapi |
Pass the openapi.yml file, this will try to use configuration from the swagger doc to populate the wizard | string |
null |
No |
name |
Pass the display name of your service | string |
null |
No |
path |
Pass the public path for your service | string |
null |
No |
backend |
Pass the internal path for your service | string |
null |
No |
CLI command for updating an existing apim directory so that you don't need to input the wizard again
@go1/apim-cli update
CLI command for validating an open api doc follows the standard schema, you can also optionally pass a --master flag to validate against a source api to check if any breaking changes have been added. Input OpenAPI files can be either JSON or YAML format. There is also a --skip flag to still show breaking changes but don't throw an error in the console.
@go1/apim-cli validate <openapi.yml> [OPTION]
@go1/apim-cli validate openapi.yml --master=source.json --skip=true
Option | Description | Type | Default | Required? |
---|---|---|---|---|
openapi |
Pass the incoming openapi.yml file that you want to validate | string |
null |
Yes |
master |
Pass the source openapi.yml file to compare the incoming changes with | string |
null |
No |
skip |
Whether you want to skip any breaking changes from throwing an error | boolean |
false |
No |
CLI command for merging two openapi docs into a single file. This is useful for merging individual services into a master open api doc.
@go1/apim-cli merge changes.yml source.yml output.json
Clone this repo and run the following commands to setup and test locally
npm install
npm run build
chmod +x ./build
./build/cli.js init
npm run test
Go1 APIM CLI
is free and open-source software licensed under the Apache 2.0 License.