Scripting swagger2api

Not applicable

I'm working on a project and am using the swagger2api tool as part of the workflow. However, for this to work effectively in the workflow, I'll need to script the usage of the tool. Currently, the tool requires interactive input of the base URL, org, and user credentials.

Can these be passed as additional arguments so that it can be scripted?

Solved Solved
1 3 154
1 ACCEPTED SOLUTION

Dear @janticouni ,

Thank you for using the tool & great suggestions. We will definitely take it forward & implement same.

- Currently, the tool requires confirmation of the base URL, org, and user credentials. Can this be passed as additional arguments so that it can be scripted and avoid the interactive ui?

Currently we capture information via interactive UI. We will make sure next version of tool supports arguments for same. I will keep you informed once above feature is available. You are welcome to submit pull request too in github. It's an open source tool. I will try to release the same today. I will keep you updated.

- I'm testing with a very simple swagger document; do you have a sample swagger doc that exposes more policies and surface area of Edge features?

Yes, We have documented same in Apigee Community Articles. Please find below links.

Getting Started with Swagger2API

Swagger2API Apigee-127 Extensions support

Secure APIs using OAuth2.0 & Verify API Key Policies in Apigee using Swagger 2.0

- Any sample swagger documents to share ?

PetStore example is great way to start. You can find same here. You can also find examples in source code examples directory. Above articles have sample swagger specs that also showcases Apigee-127 support & creating policies using A-127 extensions.

** UPDATE ** :

  • Swagger2Api - Version - 0.2.3 supports Apigee Edge Options to deploy. It will be helpful in above use case where you can use the tool to have script capabilities & automate workflows.
  • To Update Swagger2Api tool , run below command.
sudo npm update -g swagger2api
  • To check new options available, run below command
swagger2api generateApi -h
  • You need to pass all the requirement deployment options, otherwise it will trigger interactive UI & values will be overridden. See working with deployment options example below.
swagger2api generateApi petStore -s http://petstore.swagger.io/v2/swagger.json -D -d /Users/Anil/Desktop/ --baseuri https://api.enterprise.apigee.com --organization XXXXXXX --username XXXXXXXXXXXX --password XXXXXXXX --environment test --virtualhosts default,secure

Keep us posted if you have any queries.

View solution in original post

3 REPLIES 3

Dear @janticouni ,

Thank you for using the tool & great suggestions. We will definitely take it forward & implement same.

- Currently, the tool requires confirmation of the base URL, org, and user credentials. Can this be passed as additional arguments so that it can be scripted and avoid the interactive ui?

Currently we capture information via interactive UI. We will make sure next version of tool supports arguments for same. I will keep you informed once above feature is available. You are welcome to submit pull request too in github. It's an open source tool. I will try to release the same today. I will keep you updated.

- I'm testing with a very simple swagger document; do you have a sample swagger doc that exposes more policies and surface area of Edge features?

Yes, We have documented same in Apigee Community Articles. Please find below links.

Getting Started with Swagger2API

Swagger2API Apigee-127 Extensions support

Secure APIs using OAuth2.0 & Verify API Key Policies in Apigee using Swagger 2.0

- Any sample swagger documents to share ?

PetStore example is great way to start. You can find same here. You can also find examples in source code examples directory. Above articles have sample swagger specs that also showcases Apigee-127 support & creating policies using A-127 extensions.

** UPDATE ** :

  • Swagger2Api - Version - 0.2.3 supports Apigee Edge Options to deploy. It will be helpful in above use case where you can use the tool to have script capabilities & automate workflows.
  • To Update Swagger2Api tool , run below command.
sudo npm update -g swagger2api
  • To check new options available, run below command
swagger2api generateApi -h
  • You need to pass all the requirement deployment options, otherwise it will trigger interactive UI & values will be overridden. See working with deployment options example below.
swagger2api generateApi petStore -s http://petstore.swagger.io/v2/swagger.json -D -d /Users/Anil/Desktop/ --baseuri https://api.enterprise.apigee.com --organization XXXXXXX --username XXXXXXXXXXXX --password XXXXXXXX --environment test --virtualhosts default,secure

Keep us posted if you have any queries.

Thanks for the quick response, @Anil! I updated to the new version and it worked on the first go.

Awesome @janticouni , Glad your query is resolved. Keep us posted 🙂