Api proxy to Swagger code

sidd-harth
Participant V

Hi guys, I have few proxies in edge. As of now I'm working on RAML.

So is there any way where I can auto generate Swagger 1.2 code for the Api proxies in edge?

Quick answer is appreciated.

Thanks,

Sid

Solved Solved
2 19 5,029
1 ACCEPTED SOLUTION

Dear @Barahalikar Siddharth ,

We now have a tool which will convert Apigee API proxy to swagger 2.0 specification. It's called Apigee2Swagger. It's Node.JS based command line tool. You can find the npm module here.

Please let us know any feedback / suggestions regarding tool.

Cheers,

Anil Sagar

View solution in original post

19 REPLIES 19

@Mukundha Madhavan , Heard that you have used a tool which does same. Is it available for public ? Does it support swagger 1.2 or 2.0 ?

@Barahalikar Siddharth , Just FYI, Swagger to API Proxy is available now and uses swagger 2.0 spec. Find more details regarding swagger2api here.

@Anil Sagar

Thanks for adding Mukundha and yes I know about Swagger to API Poxy. As said I'm working on RAML for APIs. So there a tool for Swagger to RAML. So if I can get Swagger code for API Proxy then it would make my work a bit easy.

Dear @Barahalikar Siddharth ,

Heard back from Mukundha,

As of today, No tool is available to convert Apigee Proxies to Swagger. We would love to build one since we see a requirement. Unfortunately, We cannot commit timelines. We will keep you updated if any.

Cheers,

Anil Sagar

Looks like a great idea for suggestions here: https://community.apigee.com/content/idea/post.html

Hi @Barahalikar Siddharth,

Typically in the lifecycle, you would start with a API description/definition [wadl/swagger/raml] and then start building your APIs [apiproxy or nodejs], the description is also used to render user documentation [smartdocs]

or on the other hand, you would have the implementation [apiproxies], you could use tools like this to generate the documentation.

Generating swagger wouldn't be too hard, most of the tools/scripts mentioned in this ticket, already parses the api proxy in some way, so its just a matter of mapping to swagger.

Given the swagger support, would like to understand why RAML? and the larger usecase - is this for documentation? or something else? can you pls share your usecase?

Thanks,

Dear @Barahalikar Siddharth ,

We now have a tool which will convert Apigee API proxy to swagger 2.0 specification. It's called Apigee2Swagger. It's Node.JS based command line tool. You can find the npm module here.

Please let us know any feedback / suggestions regarding tool.

Cheers,

Anil Sagar

Thank you @Anil Sagar ,I haven't tried it yet, but I will be doing it for my next project.

@Barahalikar Siddharth , Keep us posted with your feedback & findings 🙂

This tool doesnot create paths in swagger even though the proxy on APIGEE and the downloaded proxy contains mulitple paths

@Vijay Muralitharan , Thank you for feedback. Can you provide more details regarding same. As far as i know, it does create paths. See an article here that explains same. Can you post the proxy details & generated swagger to investigate same ?

Anil,

the XML downloaded from the proxy is having Resources as empty element.I am not sure if that is the problem? Though i can see 2 resources in the UI..

Are you saying in XML bundle resources are missing ? Can you share your proxy bundle to investigate same ? What do you mean by resources ? Are they conditional flows with verbs & path matching condition ?

Can you share your proxy if possible to investigate same ?

Not applicable

I am uploading the sample proxy i am using for testing this tool

@vijay.muralitharan , Resources you have mentioned doesn't have http verb defined with them in apigee proxy flow. That's the reason you don't see any paths. Swagger 2.0 spec expects you to define http verbs under a path. Once you add a request.verb condition to your proxy conditional flow along with proxy.pathsuffix MatchesPath , you will see same in swagger 2.0 spec.

If verb is missing, ideally tool should query user which http verbs to add to swagger spec or by default add GET verb to same. Thank you for highlighting same. I will create an issue in github for same.

created a github issue here , will be fixed in next release of tool.. Please feel free to share feedback or create an issue in github. Than you @Vijay Muralitharan for highlighting same.

Not applicable

Thanks Anil..One more question

1) Is there any way of including security schemas based on the policies attached in API Proxy

2) Also what about some required headers

3) I guess schema for payload should be added aftermath in the swagger editor correct?

@vijay.muralitharan ,

1) Is there any way of including security schemas based on the policies attached in API Proxy

We don't have capability as of today. But, We definitely love to add same.

2) Also what about some required headers

We already have a feature request for same. We will add them in future releases.

3) I guess schema for payload should be added aftermath in the swagger editor correct?

Yes, you are right. It needs to be added using swagger editor. Find more about Apigee2Swagger in Article & FAQ sections.