Tuesday, November 19, 2013

Updated Swagger support for SoapUI

I've finally found some time to update the SoapUI Swagger plug-in to be compliant with both the new swagger version 1.2 and the really old 1.0. You should now be able to import any 1.0, 1.1 and 1.2 compliant swagger into SoapUI - if you can't please let me know so I can make more improvements.

From a functionality point-of-view there is no change to the previous version - download the plugin and unzip it into the soapui/bin folder; the zip will add files to the ext and plugins folders (be sure to remove any previous versions from these folders). For more details on how to use and install the plugin please check out the initial blog-post.

The plugin source code is as previously available at GitHub under the apache license.

Under the Hood - swagger4j 1.0 beta2

Driving most of these changes is an update to the swagger4j library used by the plugin - swagger4j is a standalone java library that basically provides a Java object model and corresponding readers and writers (much like other XXX4j libraries) for swagger resource listings and API declarations. Currently it doesn't support for the model-element of swagger, although that is something that I hope to support whenever a java library for JSON Schema is made available.

swagger4j is at GitHub as well - open source for your pleasure.

Outstanding Shortcomings

The major shortcomings in the plugin are related to corresponding lack of functionality in SoapUI; OAuth support (which I know the SoapUI team is working hard on for the next major release) and JSON Schema support. Thus, if your swagger contains authorizations metadata this will be "lost" when importing your Swagger into SoapUI (although the underlying swagger4j library makes it available) and you will have to set up any access-token/apiKey/authorization headers manually. Also, any JSON schemas/models in your swagger will be ignored during the import as SoapUI currently works exclusively with XML Schema for payload metadata.

As soon as support for these features is available in SoapUI, I will strive to update the plugin accordingly.

What's next?

The next major undertaking under consideration is integrating the swagger codegen utilities into the plugin which would allow you to generate code for any API defined in SoapUI (be it from Swagger, WADL or manually) for the 10+ languages supported by the swagger toolkit. Please let me know if that sounds intriguing (or if it doesn't) and of course don't hesitate to suggest any other functionality you might want to see in this plugin.

Thank you!

No comments:

Post a Comment