I'm currently discovering wso2 platform possibilities. I'd like to make an api on stoplight and initialize it through apictl on api manager. I'd like to change my endpoints and other properties. I found out in apictl init --help that there is a flag -d for definition.yaml file which may meet my expectations because every time I initialize my api it takes port 8080 by default.

So now I've got two questions:

  1. How can I generate definition.yaml file on stoplight?
  2. After obtaining this file can I manage it's properties through bash commands or through flags in apictl init command? Salut
1

There are 1 best solutions below

0
On

To get an understanding about the definition.yaml format, please refer to sample-api.yaml provided in WSO2 docs at [1]. This content is WSO2 specific, so AFAIK it cannot be generated from spotlight. This definition.yaml contains the API metadata of the API we create.

However you can use the OpenAPI/Swagger approach to acheive your requirement.

  • Download the project zip from spotlight. This will contain the openAPI definition of the API at references folder.
  • Init the API Project with OpenAPI spec (--oas flag) You may modify the endpointConfig listed in api.yaml file in the initialized project if you want to modify the endpoint values autofilled from the open API definition. Zip the project and import it.
  • Or else without editing the api.yaml file in the project you can also use a params.yaml file[2]
  • Refer to the sample params.yaml file in [2] and overwrite the endpoint details as required.

[1]. https://apim.docs.wso2.com/en/latest/install-and-setup/setup/api-controller/managing-apis-api-products/importing-apis-via-dev-first-approach/

[2]. https://apim.docs.wso2.com/en/latest/install-and-setup/setup/api-controller/advanced-topics/configuring-environment-specific-parameters/#defining-the-parameters-file-for-an-api